lldb.git
9 months agoMake check-clang depend on the LLVM split-file utility
Reid Kleckner [Mon, 23 Nov 2020 20:19:20 +0000 (12:19 -0800)]
Make check-clang depend on the LLVM split-file utility

Fixes a recently added test that has this dependency. IMO this utility
is generally useful, so we should go ahead and take the new dependency.

9 months ago[llvm-elfabi] Emit ELF header and string table sections
Haowei Wu [Tue, 29 Sep 2020 05:10:54 +0000 (22:10 -0700)]
[llvm-elfabi] Emit ELF header and string table sections

This change serves to create the initial framework for outputting ELF
files from llvm-elfabi.

Differential Revision: https://reviews.llvm.org/D61767

9 months ago[clang-tidy] Fix RenamerClangTidy checks trying to emit a fix that isnt a valid ident...
Nathan James [Mon, 23 Nov 2020 20:04:50 +0000 (20:04 +0000)]
[clang-tidy] Fix RenamerClangTidy checks trying to emit a fix that isnt a valid identifier

Addresses https://bugs.llvm.org/show_bug.cgi?id=48230.
Handle the case when the Fixup suggested isn't a valid c/c++ identifer.

Reviewed By: aaron.ballman, gribozavr2

Differential Revision: https://reviews.llvm.org/D91915

9 months ago[ms] [llvm-ml] Support purging macro definitions
Eric Astor [Mon, 23 Nov 2020 19:20:17 +0000 (14:20 -0500)]
[ms] [llvm-ml] Support purging macro definitions

Support MASM's PURGE directive.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D89735

9 months agoRevert "[llvm-elfabi] Emit ELF header and string table sections"
Haowei Wu [Mon, 23 Nov 2020 19:58:51 +0000 (11:58 -0800)]
Revert "[llvm-elfabi] Emit ELF header and string table sections"

This reverts commit 53c5fdd59a5cf7fbb4dcb7a7e84c9c4a40d32a84.

Reason of revert: Some builders failed to build with ld.

9 months agoPort -print-memderefs to NPM
Arthur Eubanks [Wed, 18 Nov 2020 07:42:18 +0000 (23:42 -0800)]
Port -print-memderefs to NPM

There is lots of code duplication, but hopefully it won't matter soon.

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D91683

9 months ago[test] Pin memory-dereferenceable.ll to legacy PM
Arthur Eubanks [Wed, 18 Nov 2020 07:18:26 +0000 (23:18 -0800)]
[test] Pin memory-dereferenceable.ll to legacy PM

-print-memderefs is only used for one test and hasn't been touched in a while.

9 months ago[CGSCC] Detect devirtualization in more cases
Arthur Eubanks [Thu, 15 Oct 2020 00:56:38 +0000 (17:56 -0700)]
[CGSCC] Detect devirtualization in more cases

The devirtualization wrapper misses cases where if it wraps a pass
manager, an individual pass may devirtualize an indirect call created by
a previous pass. For example, inlining may create a new indirect call
which is devirtualized by instcombine. Currently the devirtualization
wrapper will not see that because it only checks cgscc edges at the very
beginning and end of the pass (manager) it wraps.

This fixes some tests testing this exact behavior in the legacy PM.

Instead of checking WeakTrackingVHs for CallBases at the very beginning
and end of the pass it wraps, check every time
updateCGAndAnalysisManagerForPass() is called.

check-llvm and check-clang with -abort-on-max-devirt-iterations-reached
on by default doesn't show any failures outside of tests specifically
testing it so it doesn't needlessly rerun passes more than necessary.
(The NPM -O2/3 pipeline run the inliner/function simplification pipeline
under a devirtualization repeater pass up to 4 times by default).

http://llvm-compile-time-tracker.com/?config=O3&stat=instructions&remote=aeubanks
shows that 7zip has ~1% compile time regression. I looked at it and saw
that there indeed was devirtualization happening that was not previously
caught, so now it reruns the CGSCC pipeline on some SCCs, which is WAI.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D89587

9 months ago[AIX] Support init priority
Xiangling Liao [Mon, 23 Nov 2020 18:55:47 +0000 (13:55 -0500)]
[AIX] Support init priority

Support reserved [0-100] and non-reserved[101-65535] Clang/GNU init
priority values on AIX.
This patch maps Clang/GNU values into priority values used in sinit/sterm
functions. User can play with values and be able to get init to occur
before or after XL init and vice versa.

Differential Revision: https://reviews.llvm.org/D91272

9 months ago[test] Pin tests using -dot-callgraph to legacy PM
Arthur Eubanks [Wed, 18 Nov 2020 08:04:27 +0000 (00:04 -0800)]
[test] Pin tests using -dot-callgraph to legacy PM

-dot-callgraph is not ported to the NPM yet. It can be ported at a later
time if necessary.

Differential Revision: https://reviews.llvm.org/D91685

9 months ago[llvm-elfabi] Emit ELF header and string table sections
Haowei Wu [Tue, 29 Sep 2020 05:10:54 +0000 (22:10 -0700)]
[llvm-elfabi] Emit ELF header and string table sections

This change serves to create the initial framework for outputting ELF
files from llvm-elfabi.

Differential Revision: https://reviews.llvm.org/D61767

9 months ago[ms] [llvm-ml] Support macro function invocations in expressions
Eric Astor [Fri, 13 Nov 2020 22:39:33 +0000 (17:39 -0500)]
[ms] [llvm-ml] Support macro function invocations in expressions

Accept macro function definitions, and apply them when invoked in operand position.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D89734

9 months ago[AArch64] Update clang CodeGen tests I missed in 4252f7773a5b98b825d17e5f77c7d349cb2f...
Craig Topper [Mon, 23 Nov 2020 19:08:10 +0000 (11:08 -0800)]
[AArch64] Update clang CodeGen tests I missed in 4252f7773a5b98b825d17e5f77c7d349cb2fb7c7.

These tests invoke opt and llc even though they are in the frontend.

We now do a better job of generating commuted patterns for fma so
these tests now form fmls instead of fmla+fneg.

9 months ago[NFC] remove print statement I accidentally added.
Amy Huang [Mon, 23 Nov 2020 18:51:09 +0000 (10:51 -0800)]
[NFC] remove print statement I accidentally added.

9 months ago[AArch64] Add scatter cost model tests.
Florian Hahn [Mon, 23 Nov 2020 18:32:56 +0000 (18:32 +0000)]
[AArch64] Add scatter cost model tests.

9 months ago[mlir][Linalg] NFC: Expose some utility functions used for promotion.
MaheshRavishankar [Mon, 23 Nov 2020 18:34:48 +0000 (10:34 -0800)]
[mlir][Linalg] NFC: Expose some utility functions used for promotion.

Exposing some utility functions from Linalg to allow for promotion of
fused views outside of the core tile+fuse logic.
This is an alternative to patch D91322 which adds the promotion logic
to the tileAndFuse method. Downside with that approach is that it is
not easily customizable based on needs.

Differential Revision: https://reviews.llvm.org/D91503

9 months ago[mac/arm] fix clang/test/Driver/darwin-ld-dedup.c
Nico Weber [Mon, 23 Nov 2020 18:29:36 +0000 (13:29 -0500)]
[mac/arm] fix clang/test/Driver/darwin-ld-dedup.c

The test needs an object file, which it currenty gets with
`-target x86_64-apple-darwin10`.  Rather than adding `REQUIRES: X86`, create
the object file via yaml2obj. This way, the test runs and passes even if the
host arch isn't x86 and only the host arch is built.

Part of PR46644.

9 months ago[mlir][Linalg] Fuse sequence of Linalg operation (on buffers)
MaheshRavishankar [Mon, 23 Nov 2020 18:07:34 +0000 (10:07 -0800)]
[mlir][Linalg] Fuse sequence of Linalg operation (on buffers)

Enhance the tile+fuse logic to allow fusing a sequence of operations.

Make sure the value used to obtain tile shape is a
SubViewOp/SubTensorOp. Current logic used to get the bounds of loop
depends on the use of `getOrCreateRange` method on `SubViewOp` and
`SubTensorOp`. Make sure that the value/dim used to compute the range
is from such ops.  This fix is a reasonable WAR, but a btter fix would
be to make `getOrCreateRange` method be a method of `ViewInterface`.

Differential Revision: https://reviews.llvm.org/D90991

9 months ago[SelectionDAG][ARM][AArch64][Hexagon][RISCV][X86] Add SDNPCommutative to fma and...
Craig Topper [Mon, 23 Nov 2020 18:01:52 +0000 (10:01 -0800)]
[SelectionDAG][ARM][AArch64][Hexagon][RISCV][X86] Add SDNPCommutative to fma and fmad nodes in tablegen. Remove explicit commuted patterns from targets.

X86 was already specially marking fma as commutable which allowed
tablegen to autogenerate commuted patterns. This moves it to the target
independent definition and fix up the targets to remove now
unneeded patterns.

Unfortunately, the tests change because the commuted version of
the patterns are generating operands in a different than the
explicit patterns.

Differential Revision: https://reviews.llvm.org/D91842

9 months ago[mac/arm] make clang/test/Driver/clang_f_opts.c pass consistently
Nico Weber [Mon, 23 Nov 2020 17:55:51 +0000 (12:55 -0500)]
[mac/arm] make clang/test/Driver/clang_f_opts.c pass consistently

Part of PR46644, see comment 7/8.

9 months agoAdd userData to the diagnostic handler C API
George [Mon, 23 Nov 2020 17:52:17 +0000 (09:52 -0800)]
Add userData to the diagnostic handler C API

Previously, there was no way to add context to the diagnostic engine via the C API. Adding this ability makes it much easier to reason about memory ownership, particularly in reference-counted languages such as Swift. There are more details in the review comments.

Reviewed By: ftynse, mehdi_amini

Differential Revision: https://reviews.llvm.org/D91738

9 months ago[AArch64] Add tests for masked.gather costs.
Florian Hahn [Mon, 23 Nov 2020 17:33:27 +0000 (17:33 +0000)]
[AArch64] Add tests for masked.gather costs.

9 months ago[TableGen] Eliminte source location from CodeInit
Paul C. Anagnostopoulos [Sun, 22 Nov 2020 14:56:42 +0000 (09:56 -0500)]
[TableGen] Eliminte source location from CodeInit

Step 1 in eliminating the 'code' type.

Differential Revision: https://reviews.llvm.org/D91932

9 months ago[VE] VE Vector Predicated SDNode, vector add isel and tests
Simon Moll [Mon, 23 Nov 2020 14:33:10 +0000 (15:33 +0100)]
[VE] VE Vector Predicated SDNode, vector add isel and tests

VE Vector Predicated (VVP) SDNodes form an intermediate layer between VE
vector instructions and the initial SDNodes.

We introduce 'vvp_add' with isel and tests as the first of these VVP
nodes. VVP nodes have a mask and explicit vector length operand, which
we will make proper use of later.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D91802

9 months ago[mlir] Temporarily disable flaky mlir-cpu-runner async tests
Alex Zinenko [Mon, 23 Nov 2020 15:50:55 +0000 (16:50 +0100)]
[mlir] Temporarily disable flaky mlir-cpu-runner async tests

These tests fail sporadically on irrelevant commits, e.g.
http://lab.llvm.org:8011/#/builders/61/builds/1777 as well as in local
builds.

9 months agoFix tests for clang-query completion
Stephen Kelly [Mon, 23 Nov 2020 15:22:03 +0000 (15:22 +0000)]
Fix tests for clang-query completion

9 months ago[mlir] Add a print function for memref<*xi64>.
Alexander Belyaev [Mon, 23 Nov 2020 14:55:42 +0000 (15:55 +0100)]
[mlir] Add a print function for memref<*xi64>.

Differential Revision: https://reviews.llvm.org/D91070

9 months ago[VE] Remove magic numbers 176
Kazushi (Jam) Marukawa [Sun, 22 Nov 2020 12:57:22 +0000 (21:57 +0900)]
[VE] Remove magic numbers 176

Remove magic numbers 176 from VE source codes and update comments.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91958

9 months agoFix speling in comments. NFC.
Jay Foad [Fri, 20 Nov 2020 15:42:52 +0000 (15:42 +0000)]
Fix speling in comments. NFC.

9 months agoRemove the IgnoreImplicitCastsAndParentheses traversal kind
Stephen Kelly [Sat, 21 Nov 2020 18:54:26 +0000 (18:54 +0000)]
Remove the IgnoreImplicitCastsAndParentheses traversal kind

Differential Revision: https://reviews.llvm.org/D91918

9 months agoUpdate mode used in traverse() examples
Stephen Kelly [Sat, 21 Nov 2020 18:47:51 +0000 (18:47 +0000)]
Update mode used in traverse() examples

traverse() predates the IgnoreUnlessSpelledInSource mode. Update example
and test code to use the newer mode.

Differential Revision: https://reviews.llvm.org/D91917

9 months agoRemove automatic traversal from forEach matcher
Stephen Kelly [Sat, 23 May 2020 01:12:51 +0000 (02:12 +0100)]
Remove automatic traversal from forEach matcher

Differential Revision: https://reviews.llvm.org/D91916

9 months ago[test] Update PR reference in testcase [NFC]
Mikael Holmen [Mon, 23 Nov 2020 14:12:15 +0000 (15:12 +0100)]
[test] Update PR reference in testcase [NFC]

The testcase was added in faf848ac32 to test the fix of PR 47969, but
it was named pr48980 (which happens to be the TR number in my downstream
issue system).

9 months ago[mlir] canonicalize away zero-iteration SCF for loops
Alex Zinenko [Fri, 20 Nov 2020 18:22:30 +0000 (19:22 +0100)]
[mlir] canonicalize away zero-iteration SCF for loops

An SCF 'for' loop does not iterate if its lower bound is equal to its upper
bound. Remove loops where both bounds are the same SSA value as such bounds are
guaranteed to be equal. Similarly, remove 'parallel' loops where at least one
pair of respective lower/upper bounds is specified by the same SSA value.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D91880

9 months ago[Inline] Fix in handling of ptrtoint in InlineCost
Mikael Holmen [Mon, 23 Nov 2020 12:15:10 +0000 (13:15 +0100)]
[Inline] Fix in handling of ptrtoint in InlineCost

ConstantOffsetPtrs contains mappings from a Value to a base pointer and
an offset. The offset is typed and has a size, and at least when dealing
with ptrtoint, it could happen that we had a mapping from a ptrtoint
with type i32 to an offset with type i16. This could later cause
problems, showing up in PR 47969 and PR 38500.

In PR 47969 we ended up in an assert complaining that trunc i16 to i16
is invalid and in Pr 38500 that a cmp on an i32 and i16 value isn't
valid.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D90610

9 months ago[lldb] [test] Restore Windows-skip on 'process connect' tests
Michał Górny [Mon, 23 Nov 2020 13:27:02 +0000 (14:27 +0100)]
[lldb] [test] Restore Windows-skip on 'process connect' tests

9 months ago[llvm-readobj][test] - Simplify the gnu-notes.test
Georgii Rymar [Mon, 23 Nov 2020 11:11:09 +0000 (14:11 +0300)]
[llvm-readobj][test] - Simplify the gnu-notes.test

This test contains YAMLs that can be merged with use of macros.
This opens road for adding more test cases.

Differential revision: https://reviews.llvm.org/D91953

9 months ago[AMDGPU][MC] Improved diagnostic messages
Dmitry Preobrazhensky [Mon, 23 Nov 2020 13:07:26 +0000 (16:07 +0300)]
[AMDGPU][MC] Improved diagnostic messages

See bug 47518 (https://bugs.llvm.org/show_bug.cgi?id=47518)

Reviewers: rampitec

Differential Revision: https://reviews.llvm.org/D91794

9 months agoIgnore noderef attribute in unevaluated context
Jann Horn [Mon, 23 Nov 2020 13:10:35 +0000 (08:10 -0500)]
Ignore noderef attribute in unevaluated context

The noderef attribute is for catching code that accesses pointers in
a different address space. Unevaluated code is always safe in that regard.

9 months ago[mlir] Avoid cloning ops in SCF parallel conversion to CFG
Alex Zinenko [Mon, 23 Nov 2020 12:22:51 +0000 (13:22 +0100)]
[mlir] Avoid cloning ops in SCF parallel conversion to CFG

The existing implementation of the conversion from SCF Parallel operation to
SCF "for" loops in order to further convert those loops to branch-based CFG has
been cloning the loop and reduction body operations into the new loop because
ConversionPatternRewriter was missing support for moving blocks while replacing
their arguments. This functionality now available, use it to implement the
conversion and avoid cloning operations, which may lead to doubling of the IR
size during the conversion.

In addition, this fixes an issue with converting nested SCF "if" conditionals
present in "parallel" operations that would cause the conversion infrastructure
to stop because of the repeated application of the pattern converting "newly"
created "if"s (which were in fact just moved). Arguably, this should be fixed
at the infrastructure level and this fix is a workaround.

Reviewed By: herhut

Differential Revision: https://reviews.llvm.org/D91955

9 months ago[clangd] textDocument/implementation (LSP layer)
Utkarsh Saxena [Wed, 18 Nov 2020 12:25:09 +0000 (13:25 +0100)]
[clangd] textDocument/implementation (LSP layer)

Differential Revision: https://reviews.llvm.org/D91721

9 months ago[AMDGPU][MC] Improved diagnostic messages for invalid literals
Dmitry Preobrazhensky [Mon, 23 Nov 2020 12:44:47 +0000 (15:44 +0300)]
[AMDGPU][MC] Improved diagnostic messages for invalid literals

See bug 47518 (https://bugs.llvm.org/show_bug.cgi?id=47518)

Reviewers: rampitec

Differential Revision: https://reviews.llvm.org/D91793

9 months ago[mlir][Linalg] Drop symbol_source abstraction which does not pay for itself.
Nicolas Vasilache [Mon, 23 Nov 2020 12:16:00 +0000 (12:16 +0000)]
[mlir][Linalg] Drop symbol_source abstraction which does not pay for itself.

Differential Revision: https://reviews.llvm.org/D91956

9 months agoRevert "[clangd] testPath's final result agrees with the passed in Style"
Kadir Cetinkaya [Mon, 23 Nov 2020 12:12:35 +0000 (13:12 +0100)]
Revert "[clangd] testPath's final result agrees with the passed in Style"

This reverts commit 8cec8de2a4e6692da6226bb02cf417eb0e50adde as it
breaks windows buildbots.

9 months ago[VE] Clean canRealignStack implementation
Kazushi (Jam) Marukawa [Sun, 22 Nov 2020 10:36:52 +0000 (19:36 +0900)]
[VE] Clean canRealignStack implementation

Old canRealignStack calls TRI::canRealignStack and hasReservedCallFrame.
But, this hasReservedCallFrame return true whenever for VE since VE
allocates call frame all the time.  It means this canRealignStack is
identical to TRI::canRealignStack.  This patch removes VE's
canRealignStack and let caller call TRI::canRealignStack directly.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91929

9 months ago[VE][NFC] Clean stack frame description
Kazushi (Jam) Marukawa [Sun, 22 Nov 2020 10:49:45 +0000 (19:49 +0900)]
[VE][NFC] Clean stack frame description

Move stack frame description from VESubtarget.cpp to VEFrameLowering.cpp
and add detail.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91946

9 months ago[clangd] testPath's final result agrees with the passed in Style
Kadir Cetinkaya [Mon, 23 Nov 2020 09:31:04 +0000 (10:31 +0100)]
[clangd] testPath's final result agrees with the passed in Style

This was confusing, as testRoot on windows results in C:\\clangd-test
and testPath generated with posix explicitly still contained backslashes.

This patch ensures not only the relative part, but the whole final result
respects passed in Style.

Differential Revision: https://reviews.llvm.org/D91947

9 months ago[APInt] Add the truncOrSelf resizing operator to APInt
Kerry McLaughlin [Mon, 23 Nov 2020 11:05:50 +0000 (11:05 +0000)]
[APInt] Add the truncOrSelf resizing operator to APInt

Truncates the APInt if the bit width is greater than the width specified,
otherwise do nothing

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D91445

9 months ago[clangd] Get rid of clangToolingRefactoring dependency
Kirill Bobyrev [Mon, 23 Nov 2020 10:59:17 +0000 (11:59 +0100)]
[clangd] Get rid of clangToolingRefactoring dependency

D71880 makes this dependency redundant and we can safely remove it. Tested for
both shared lib build and static lib build.

Reviewed By: hokein

Differential Revision: https://reviews.llvm.org/D91951

9 months ago[AArch64][SVE] Allow lax conversion between VLATs and GNU vectors
Joe Ellis [Wed, 18 Nov 2020 12:13:05 +0000 (12:13 +0000)]
[AArch64][SVE] Allow lax conversion between VLATs and GNU vectors

Previously, lax conversions were only allowed between SVE vector-length
agnostic types and vector-length specific types. This meant that code
such as the following:

    #include <arm_sve.h>
    #define N __ARM_FEATURE_SVE_BITS
    #define FIXED_ATTR __attribute__ ((vector_size (N/8)))
    typedef float fixed_float32_t FIXED_ATTR;

    void foo() {
        fixed_float32_t fs32;
        svfloat64_t s64;
        fs32 = s64;
    }

was not allowed.

This patch makes a minor change to areLaxCompatibleSveTypes to allow for
lax conversions to be performed between SVE vector-length agnostic types
and GNU vectors.

Differential Revision: https://reviews.llvm.org/D91696

9 months ago[clangd] Implement Decl canonicalization rules for rename
Kirill Bobyrev [Mon, 23 Nov 2020 10:42:51 +0000 (11:42 +0100)]
[clangd] Implement Decl canonicalization rules for rename

This patch introduces new canonicalization rules which are used for AST-based
rename in Clangd. By comparing two canonical declarations of inspected nodes,
Clangd determines whether both of them belong to the same entity user would
like to rename. Such functionality is relatively concise compared to the
Clang-Rename API that is used right now. It also helps to overcome the
limitations that Clang-Rename originally had and helps to eliminate several
classes of bugs.

Clangd AST-based rename currently relies on Clang-Rename which has design
limitations and also lacks some features. This patch breaks this dependency and
significantly reduces the amount of code to maintain (Clang-Rename is ~2000 LOC,
this patch is just <30 LOC of replacement code).

We eliminate technical debt by simultaneously

* Maintaining feature parity and ensuring no regressions
* Opening a straightforward path to improving existing rename bugs
* Making it possible to add more capabilities to rename feature which would not
  be possible with Clang-Rename

Reviewed By: hokein

Differential Revision: https://reviews.llvm.org/D71880

9 months ago[mlir][Linalg] NFC - Factor out Linalg functionality for shape and loop bounds comput...
Nicolas Vasilache [Mon, 23 Nov 2020 10:13:20 +0000 (10:13 +0000)]
[mlir][Linalg] NFC - Factor out Linalg functionality for shape and loop bounds computation

This revision refactors code used in various Linalg transformations and makes it a first class citizen to the LinalgStructureOpInterface. This is in preparation to allowing more advanced Linalg behavior but is otherwise NFC.

Differential revision: https://reviews.llvm.org/D91863

9 months ago[AST] Build recovery expression by default for all language.
Haojian Wu [Mon, 23 Nov 2020 09:57:27 +0000 (10:57 +0100)]
[AST] Build recovery expression by default for all language.

The dependency mechanism for C has been implemented, and we have rolled out
this to all internal users, didn't see crashy issues, we consider it is stable
enough.

Differential Revision: https://reviews.llvm.org/D89046

9 months ago[llvm-readelf/obj] - Fix the possible crash when dumping group sections.
Georgii Rymar [Mon, 23 Nov 2020 08:53:40 +0000 (11:53 +0300)]
[llvm-readelf/obj] - Fix the possible crash when dumping group sections.

It is possible to trigger a crash/misbehavior when the st_name field of
the signature symbol goes past the end of the string table.

This patch fixes it.

Differential revision: https://reviews.llvm.org/D91943

9 months ago[SCEV] Fix incorrect treatment of max taken count. PR48225
Max Kazantsev [Mon, 23 Nov 2020 09:45:20 +0000 (16:45 +0700)]
[SCEV] Fix incorrect treatment of max taken count. PR48225

SCEV makes a logical mistake when handling EitherMayExit in
case when both conditions must be met to exit the loop. The
mistake looks like follows: "if condition `A` fails within at most `X` first
iterations, and `B` fails within at most `Y` first iterations, then `A & B`
fails at most within `min (X, Y)` first iterations". This is wrong, because
both of them must fail at the same time.

Simple example illustrating this is following: we have an IV with step 1,
condition `A` = "IV is even", condition `B` = "IV is odd". Both `A` and `B`
will fail within first two iterations. But it doesn't mean that both of them
will fail within first two first iterations at the same time, which would mean
that IV is neither even nor odd at the same time within first 2 iterations.

We can only do so for known exact BE counts, but not for max.

Differential Revision: https://reviews.llvm.org/D91942
Reviewed By: nikic

9 months ago[llvm-readobj] - Stop using `unwrapOrError` in `DumpStyle<ELFT>::getGroups()`
Georgii Rymar [Fri, 20 Nov 2020 09:03:18 +0000 (12:03 +0300)]
[llvm-readobj] - Stop using `unwrapOrError` in `DumpStyle<ELFT>::getGroups()`

With this we are able to diagnose possible issues much better and
don't exit on an error.

Differential revision: https://reviews.llvm.org/D91867

9 months ago[clangd] Second attempt at fixing windows buildbots
Kadir Cetinkaya [Mon, 23 Nov 2020 09:06:33 +0000 (10:06 +0100)]
[clangd] Second attempt at fixing windows buildbots

9 months ago[DebugInfo] Refactor code for emitting DWARF expressions for FP constants
Pavel Labath [Fri, 6 Nov 2020 09:44:14 +0000 (10:44 +0100)]
[DebugInfo] Refactor code for emitting DWARF expressions for FP constants

This patch moves the selection of the style used to emit the numbers
(DW_OP_implicit_value vs. DW_OP_const+DW_OP_stack_value) into
DwarfExpression::addUnsignedConstant. This logic is not FP-specific, and
it will be needed for large integers too.

The refactor also makes DW_OP_implicit_value (DW_OP_stack_value worked
already) be used for floating point constants other than float and
double, so I've added a _Float16 test for it.

Split off from D90916.

Differential Revision: https://reviews.llvm.org/D91058

9 months ago[LoopFlatten] Widen IV, support ZExt.
Sjoerd Meijer [Sat, 21 Nov 2020 14:13:36 +0000 (14:13 +0000)]
[LoopFlatten] Widen IV, support ZExt.

I disabled the widening in fa5cb4b because it run in an assert, which was
related to replacing values with different types. I forgot that an extend could
also be a zero-extend, which I have added now. This means that the approach now
is to create and insert a trunc value of the outerloop for each user, and use
that to replace IV values.

Differential Revision: https://reviews.llvm.org/D91690

9 months ago[lldb] Prevent 'process connect' from using local-only plugins
Michał Górny [Fri, 20 Nov 2020 16:12:22 +0000 (17:12 +0100)]
[lldb] Prevent 'process connect' from using local-only plugins

Add a 'can_connect' parameter to Process plugin initialization, and use
it to filter plugins to these capable of remote connections.  This is
used to prevent 'process connect' from picking up a plugin that can only
be used locally, e.g. the legacy FreeBSD plugin.

Differential Revision: https://reviews.llvm.org/D91810

9 months ago[clang-tidy] Fix a nullptr-access crash in unused-raii-check.
Haojian Wu [Mon, 23 Nov 2020 08:44:19 +0000 (09:44 +0100)]
[clang-tidy] Fix a nullptr-access crash in unused-raii-check.

I saw this crash in our internal production, but unfortunately didn't get
reproduced testcase, we likely hit this crash when the AST is ill-formed
(e.g. broken code).

Reviewed By: gribozavr2

Differential Revision: https://reviews.llvm.org/D91614

9 months ago[lldb] [Process/FreeBSDRemote] Fix regset names and related tests
Michał Górny [Sat, 21 Nov 2020 21:15:34 +0000 (22:15 +0100)]
[lldb] [Process/FreeBSDRemote] Fix regset names and related tests

Restore Linux-alike regset names for AVX/MPX registers
as TestLldbGdbServer seems to depend on them.  At the same time, fix
TestRegisters to be aware that they are not available on FreeBSD
and NetBSD, at least until we figure out a better way of reporting
unsupported register sets.

Differential Revision: https://reviews.llvm.org/D91923

9 months ago[lldb] [test] Fix qRegisterInfo lldb-server tests to handle missing registers
Michał Górny [Sat, 21 Nov 2020 20:46:05 +0000 (21:46 +0100)]
[lldb] [test] Fix qRegisterInfo lldb-server tests to handle missing registers

Fix qRegisterInfo tests to handle Exx error response when querying
registers that are not supported on the platform in question.  This
is how FreeBSD and NetBSD platforms reporting missing registers right
now, and there certainly is value from verifying the remaining
registers.

This change fixes the test for FreeBSD but NetBSD has other regressions
that still need to be researched.

Differential Revision: https://reviews.llvm.org/D91922

9 months ago[lldb] [Process/Utility] Declare register overlaps between ST and MM
Michał Górny [Wed, 18 Nov 2020 19:16:01 +0000 (20:16 +0100)]
[lldb] [Process/Utility] Declare register overlaps between ST and MM

Explicitly declare register overlaps/invalidation between ST(i) and MMi
registers.

Differential Revision: https://reviews.llvm.org/D91728

9 months ago[lldb] [Process/FreeBSD] Add missing 'override' kws to POSIXStopInfo
Michał Górny [Sun, 22 Nov 2020 16:42:19 +0000 (17:42 +0100)]
[lldb] [Process/FreeBSD] Add missing 'override' kws to POSIXStopInfo

Differential Revision: https://reviews.llvm.org/D91934

9 months ago[clangd] Attempt at fixing ExternalIndex tests on windows
Kadir Cetinkaya [Mon, 23 Nov 2020 08:16:00 +0000 (09:16 +0100)]
[clangd] Attempt at fixing ExternalIndex tests on windows

9 months ago[libc++] [www] Mark P0482 as "In Progress", as some parts of it are already implemented.
Marek Kurdej [Mon, 23 Nov 2020 08:10:20 +0000 (09:10 +0100)]
[libc++] [www] Mark P0482 as "In Progress", as some parts of it are already implemented.

9 months ago[llvm-readobj] - Don't crash when relocation table goes past the EOF.
Georgii Rymar [Thu, 19 Nov 2020 09:18:18 +0000 (12:18 +0300)]
[llvm-readobj] - Don't crash when relocation table goes past the EOF.

It is possible to trigger reading past the EOF by breaking fields like
DT_PLTRELSZ, DT_RELSZ or DT_RELASZ

This patch adds a validation in `DynRegionInfo` helper class.

Differential revision: https://reviews.llvm.org/D91787

9 months ago[NFC] Reduce code duplication in binop processing in computeExitLimitFromCondCached
Max Kazantsev [Mon, 23 Nov 2020 06:18:12 +0000 (13:18 +0700)]
[NFC] Reduce code duplication in binop processing in computeExitLimitFromCondCached

Handling of `and` and `or` vastly uses copy-paste. Factored out into
a helper function as preparation step for further fix (see PR48225).

Differential Revision: https://reviews.llvm.org/D91864
Reviewed By: nikic

9 months ago[CodeGen] Use pred_empty (NFC)
Kazu Hirata [Mon, 23 Nov 2020 06:16:12 +0000 (22:16 -0800)]
[CodeGen] Use pred_empty (NFC)

9 months ago[ValueMapper] Remove unused declaration remapFunction (NFC)
Kazu Hirata [Mon, 23 Nov 2020 05:52:03 +0000 (21:52 -0800)]
[ValueMapper] Remove unused declaration remapFunction (NFC)

The function declaration with two parameters was introduced on Apr 16
2016 in commit f0d73f95c15f909c6034f1735632695248bb75a8 without a
corresponding definition.

9 months ago[hwasan] Remove unused declaration shadowBase (NFC)
Kazu Hirata [Mon, 23 Nov 2020 04:08:50 +0000 (20:08 -0800)]
[hwasan] Remove unused declaration shadowBase (NFC)

The function was introduced on Jan 23, 2019 in commit
73078ecd381b5ce95638c7a8e41fcabb6c27703a.

Its definition was removed on Oct 27, 2020 in commit
0930763b4baf926a39dd2d0571fd9e2102ec3831, leaving the declaration
unused.

9 months ago[MLIR] ODS typedef gen fixes & improvements
John Demme [Mon, 23 Nov 2020 00:04:43 +0000 (16:04 -0800)]
[MLIR] ODS typedef gen fixes & improvements

- Fixes bug 48242 point 3 crash.
- Makes the improvments from points 1 & 2.

https://bugs.llvm.org/show_bug.cgi?id=48262

```
   def RTLValueType : Type<CPred<"isRTLValueType($_self)">, "Type"> {
     string cppType = "::mlir::Type";
   }
```
Works now, but merely by happenstance. Parameters expects a `TypeParameter` class def or a string representing a c++ type but doesn't enforce it.

Reviewed By: lattner

Differential Revision: https://reviews.llvm.org/D91939

9 months ago[Clang] Add __STDCPP_THREADS__ to standard predefine macros
Zequan Wu [Wed, 18 Nov 2020 23:26:21 +0000 (15:26 -0800)]
[Clang] Add __STDCPP_THREADS__ to standard predefine macros

According to https://eel.is/c++draft/cpp.predefined#2.6, `__STDCPP_THREADS__` is a predefined macro.

Differential Revision: https://reviews.llvm.org/D91747

9 months ago[ARM] Ensure MVE_TwoOpPattern is used inside Predicate's
David Green [Sun, 22 Nov 2020 21:38:00 +0000 (21:38 +0000)]
[ARM] Ensure MVE_TwoOpPattern is used inside Predicate's

9 months ago[gn build] (manually) port ed424b428
Nico Weber [Sun, 22 Nov 2020 21:12:08 +0000 (16:12 -0500)]
[gn build] (manually) port ed424b428

9 months ago[ARM] MVE VABD tests. NFC
David Green [Sun, 22 Nov 2020 21:16:49 +0000 (21:16 +0000)]
[ARM] MVE VABD tests. NFC

9 months ago[gn build] Port 067ffbfe601
LLVM GN Syncbot [Sun, 22 Nov 2020 21:09:32 +0000 (21:09 +0000)]
[gn build] Port 067ffbfe601

9 months ago[gn build] sort of merge 37ac559fccd4
Nico Weber [Sun, 22 Nov 2020 21:07:33 +0000 (16:07 -0500)]
[gn build] sort of merge 37ac559fccd4

It'd be nicer if there was a group target that forwarded either to
//clang-tools-extra/clangd/index/remote or
//clangd/index/remote/unimplemented based on if remote index is enabled,
but for now it's never enabled in the gn build.

9 months ago[mlir][Python] Support finding pybind11 from the python environment.
Stella Laurenzo [Sat, 21 Nov 2020 01:57:46 +0000 (17:57 -0800)]
[mlir][Python] Support finding pybind11 from the python environment.

* Makes `pip install pybind11` do the right thing with no further config.
* Since we now require a version of pybind11 greater than many LTS OS installs (>=2.6), a more convenient way to get a recent version is preferable.
* Also adds the version spec to find_package so it will skip older versions that may be lying around.
* Tested the full matrix of old system install, no system install, pip install and no pip install.

Differential Revision: https://reviews.llvm.org/D91903

9 months ago[clangd] Fix use-after-free in ProjectAwareIndex tests
Kadir Cetinkaya [Sun, 22 Nov 2020 20:29:45 +0000 (21:29 +0100)]
[clangd] Fix use-after-free in ProjectAwareIndex tests

9 months ago[clangd] Use ProjectAwareIndex in ClangdMain
Kadir Cetinkaya [Thu, 5 Nov 2020 22:55:04 +0000 (23:55 +0100)]
[clangd] Use ProjectAwareIndex in ClangdMain

Put project-aware-index between command-line specified static index and
ClangdServer indexes.

This also moves remote-index dependency from clangDaemon to ClangdMain
in an attempt to prevent cyclic dependency between clangDaemon and
remote-index-marshalling.

Differential Revision: https://reviews.llvm.org/D91860

9 months ago[clangd] Introduce ProjectAwareIndex
Kadir Cetinkaya [Mon, 2 Nov 2020 10:27:21 +0000 (11:27 +0100)]
[clangd] Introduce ProjectAwareIndex

An index implementation that can dispatch to a variety of indexes
depending on the file path. Enables clangd to work with multiple indexes in the
same instance, configured via config files.

Depends on D90749, D90746

Differential Revision: https://reviews.llvm.org/D90750

9 months ago[clangd] Introduce config compilation for External blocks
Kadir Cetinkaya [Tue, 6 Oct 2020 12:21:42 +0000 (13:21 +0100)]
[clangd] Introduce config compilation for External blocks

Compilation logic for External blocks. A few of the high level points:
- Requires exactly one-of File/Server at a time:
  - Server is ignored in case of both, with a warning.
  - Having none is an error, would render ExternalBlock void.
- Ensures mountpoint is an absolute path:
  - Interprets it as relative to FragmentDirectory.
  - Defaults to FragmentDirectory when empty.
- Marks Background as Skip.

Depends on D90748.

Differential Revision: https://reviews.llvm.org/D90749

9 months ago[clangd] Introduce config parsing for External blocks
Kadir Cetinkaya [Thu, 1 Oct 2020 11:29:55 +0000 (12:29 +0100)]
[clangd] Introduce config parsing for External blocks

Enable configuration of remote and static indexes through config files
in addition to command line arguments.

Differential Revision: https://reviews.llvm.org/D90748

9 months agoBuild reproducible tarballs for releases
Aaron Puchert [Sun, 22 Nov 2020 19:51:00 +0000 (20:51 +0100)]
Build reproducible tarballs for releases

Currently the tarballs contain superfluous metadata, like the user name
of the packager and via Pax headers even the PID of the tar process that
packaged the files. We build the monorepo projects directly from the git
repo using "git archive" and for the test-suite we add some flags as
recommended by https://reproducible-builds.org/docs/archives/. We don't
use numeric owners though to be compatible with "git archive".

The advantage of "git archive" is that the releaser doesn't have to
download the tar ball and extract it, rather the archive is built
directly from the repository. This is probably what GitHub uses
internally to produce the tarballs, so I wouldn't expect a difference.

Reviewed By: tstellar

Differential Revision: https://reviews.llvm.org/D91494

9 months ago[Sema] Introduce function reference conversion, NFC
Aaron Puchert [Sun, 22 Nov 2020 17:43:15 +0000 (18:43 +0100)]
[Sema] Introduce function reference conversion, NFC

Technically 'noexcept' isn't a qualifier, so this should be a separate conversion.

Also make the test a pure frontend test.

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D67112

9 months ago[BasicAA] Avoid unnecessary cache update (NFC)
Nikita Popov [Sun, 22 Nov 2020 19:09:56 +0000 (20:09 +0100)]
[BasicAA] Avoid unnecessary cache update (NFC)

If the final recursive query returns MayAlias as well, there is
no need to update the cache (which already stores MayAlias).

9 months ago[CostModel] add basic handling for FP maximum/minimum intrinsics
Sanjay Patel [Sun, 22 Nov 2020 18:43:53 +0000 (13:43 -0500)]
[CostModel] add basic handling for FP maximum/minimum intrinsics

This might be a regression for some ARM targets, but that should
be changed in the target-specific overrides.

There is apparently still no default lowering for these nodes,
so I am assuming these intrinsics are not in common use.
X86, PowerPC, and RISC-V for example, just crash given the most
basic IR.

9 months ago[CostModel] add tests for FP maximum; NFC
Sanjay Patel [Sun, 22 Nov 2020 18:33:42 +0000 (13:33 -0500)]
[CostModel] add tests for FP maximum; NFC

These min/max intrinsics are not handled in the basic
implementation and probably not handled in target-specific
overrides either.

9 months ago[ValueTracking][MemCpyOpt] avoid crash on inttoptr with vector pointer type (PR48075)
Sanjay Patel [Sun, 22 Nov 2020 17:54:18 +0000 (12:54 -0500)]
[ValueTracking][MemCpyOpt] avoid crash on inttoptr with vector pointer type (PR48075)

9 months ago[BasicAA] Add more phi-phi tests (NFC)
Nikita Popov [Sun, 22 Nov 2020 12:50:23 +0000 (13:50 +0100)]
[BasicAA] Add more phi-phi tests (NFC)

Test a few more variations:
 * NoAlias with different strides
 * MustAlias without loop
 * MustAlias with same stride
 * MustAlias base pointers with different stride

9 months ago[libc++] [libc++abi] Use C++20 standard.
Marek Kurdej [Sun, 22 Nov 2020 14:56:39 +0000 (15:56 +0100)]
[libc++] [libc++abi] Use C++20 standard.

This change is needed to use char8_t when building libc++.
Using the same standard in libc++abi for coherence.

See https://reviews.llvm.org/D91517.

Reviewed By: ldionne, #libc, #libc_abi

Differential Revision: https://reviews.llvm.org/D91691

9 months agoAdd Semantic check for Flang OpenMP 4.5 - 2.7.1 ordered and collapse clause
Yashaswini [Sun, 22 Nov 2020 13:06:59 +0000 (18:36 +0530)]
Add Semantic check for Flang OpenMP 4.5 - 2.7.1 ordered and collapse clause

Semantic check added to check and restrict the value of the parameter in the COLLAPSE or ORDERED clause
if it is larger than the number of nested loops following the construct.

Test Cases:
omp-do-collapse-positivecases.f90
omp-do-collapse.f90
omp-do-ordered-positivecases.f90
omp-do-ordered.f90

Reviewed by: Kiran Chandramohan @kiranchandramohan , Valentin Clement @clementval

Differential Revision: https://reviews.llvm.org/D89860

9 months ago[DAG] LowerMINMAX - move default expansion to generic TargetLowering::expandIntMINMAX
Simon Pilgrim [Sun, 22 Nov 2020 13:02:27 +0000 (13:02 +0000)]
[DAG] LowerMINMAX - move default expansion to generic TargetLowering::expandIntMINMAX

This is part of the discussion on D91876 about trying to reduce custom lowering of MIN/MAX ops on older SSE targets - if we can improve generic vector expansion we should be able to relax the limitations in SelectionDAGBuilder when it will let MIN/MAX ops be generated, and avoid having to flag so many ops as 'custom'.

9 months ago[clangd] Fix compile error after 20b69af7
Nathan James [Sun, 22 Nov 2020 10:48:48 +0000 (10:48 +0000)]
[clangd] Fix compile error after 20b69af7

Some of the buildbots were failing due to what seems to be them using a non c++14 compilant std::string implementation.
Since c++14 std::basic_string::append(const basic_string, size_t, size_t) has a defaulted 3rd paramater, but some of the build bots were reporting that it wasn't defaulted in their implementation.

9 months ago[Analysis] Remove unused system header includes
Simon Pilgrim [Sun, 22 Nov 2020 10:30:43 +0000 (10:30 +0000)]
[Analysis] Remove unused system header includes

Cleanup unused system headers and fix an implicit dependency

9 months ago[clangd] Add clang-tidy options to config
Nathan James [Sun, 22 Nov 2020 10:04:00 +0000 (10:04 +0000)]
[clangd] Add clang-tidy options to config

First step of implementing clang-tidy configuration into clangd config.
This is just adding support for reading and verifying the clang tidy options from the config fragments.
No support is added for actually using the options within clang-tidy yet.

That will be added in a follow up as its a little more involved.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D90531

9 months ago[RISCV] Use separate Lo and Hi MemOperands when expanding BuildPairF64Pseudo and...
Craig Topper [Sun, 22 Nov 2020 08:43:12 +0000 (00:43 -0800)]
[RISCV] Use separate Lo and Hi MemOperands when expanding BuildPairF64Pseudo and SplitF64Pseudo.

We generate two 4 byte loads or two stores as part of the expansion.
Previously the MemOperand was set the same for both to cover the
full 8 bytes. Now we set a separate 4 byte mem operand for each
with a 4 byte offset for the high part.

9 months ago[PowerPC] Extend folding RLWINM + RLWINM to post-RA.
Esme-Yi [Sun, 22 Nov 2020 07:37:24 +0000 (07:37 +0000)]
[PowerPC] Extend folding RLWINM + RLWINM to post-RA.

Summary: We have the patterns to fold 2 RLWINMs before RA, while some RLWINM will be generated after RA, for example rGc4690b007743. If the RLWINM generated after RA followed by another RLWINM, we expect to perform the optimization too.

Reviewed By: shchenz

Differential Revision: https://reviews.llvm.org/D89855