2 days agoMerge branch 'addmainunit4-altlink-sharedstmt-dieref-dwz3-inlinebug-testcategory... dwz
Jan Kratochvil [Sun, 16 May 2021 14:25:38 +0000 (16:25 +0200)]
Merge branch 'addmainunit4-altlink-sharedstmt-dieref-dwz3-inlinebug-testcategory-testcase' into addmainunit4-altlink-sharedstmt-dieref-dwz3-inlinebug-testcategory-testcase-symlink

2 days agoMerge branch 'addmainunit4-altlink-sharedstmt-dieref-dwz3-inlinebug-testcategory...
Jan Kratochvil [Sun, 16 May 2021 14:25:33 +0000 (16:25 +0200)]
Merge branch 'addmainunit4-altlink-sharedstmt-dieref-dwz3-inlinebug-testcategory' into addmainunit4-altlink-sharedstmt-dieref-dwz3-inlinebug-testcategory-testcase

2 days agoMerge branch 'addmainunit4-altlink-sharedstmt-dieref-dwz3-inlinebug' into addmainunit...
Jan Kratochvil [Sun, 16 May 2021 14:25:28 +0000 (16:25 +0200)]
Merge branch 'addmainunit4-altlink-sharedstmt-dieref-dwz3-inlinebug' into addmainunit4-altlink-sharedstmt-dieref-dwz3-inlinebug-testcategory

2 days agoMerge branch 'addmainunit4-altlink-sharedstmt-dieref-dwz3' into addmainunit4-altlink...
Jan Kratochvil [Sun, 16 May 2021 14:25:23 +0000 (16:25 +0200)]
Merge branch 'addmainunit4-altlink-sharedstmt-dieref-dwz3' into addmainunit4-altlink-sharedstmt-dieref-dwz3-inlinebug

2 days agoMerge branch 'addmainunit4-altlink-sharedstmt-dieref' into addmainunit4-altlink-share...
Jan Kratochvil [Sun, 16 May 2021 14:25:18 +0000 (16:25 +0200)]
Merge branch 'addmainunit4-altlink-sharedstmt-dieref' into addmainunit4-altlink-sharedstmt-dieref-dwz3

2 days agoMerge branch 'addmainunit4-altlink-sharedstmt' into addmainunit4-altlink-sharedstmt...
Jan Kratochvil [Sun, 16 May 2021 14:25:14 +0000 (16:25 +0200)]
Merge branch 'addmainunit4-altlink-sharedstmt' into addmainunit4-altlink-sharedstmt-dieref

2 days agoMerge branch 'addmainunit4-altlink' into addmainunit4-altlink-sharedstmt
Jan Kratochvil [Sun, 16 May 2021 14:25:09 +0000 (16:25 +0200)]
Merge branch 'addmainunit4-altlink' into addmainunit4-altlink-sharedstmt

2 days agoMerge branch 'addmainunit4' into addmainunit4-altlink
Jan Kratochvil [Sun, 16 May 2021 14:25:05 +0000 (16:25 +0200)]
Merge branch 'addmainunit4' into addmainunit4-altlink

2 days agoMerge remote-tracking branch 'origin/main' into addmainunit4
Jan Kratochvil [Sun, 16 May 2021 14:25:00 +0000 (16:25 +0200)]
Merge remote-tracking branch 'origin/main' into addmainunit4

2 days ago[CaptureTracking] Simplify reachability check (NFCI)
Nikita Popov [Sun, 16 May 2021 14:04:10 +0000 (16:04 +0200)]
[CaptureTracking] Simplify reachability check (NFCI)

This code was re-implementing the same-BB case of
isPotentiallyReachable(). Historically, this was done because
CaptureTracking used additional caching for local dominance
queries. Now that it is no longer needed, the code is effectively
the same as isPotentiallyReachable().

The only difference are extra checks for invoke/phis. These are
misleading checks related to dominance in the value availability
sense that are not relevant for control reachability. The invoke
check was correct but redundant in that invokes are always
terminators, so `I` could never come before the invoke. The phi
check is a matter of interpretation (should an earlier phi node be
considered reachable from a later phi node in the same block?)
but ultimately doesn't matter because phis don't capture anyway.

2 days agoReapply [CaptureTracking] Do not check domination
Nikita Popov [Sun, 16 May 2021 08:40:02 +0000 (10:40 +0200)]
Reapply [CaptureTracking] Do not check domination

Reapply after adjusting the synchronized.m test case, where the
TODO is now resolved. The pointer is only captured on the exception
handling path.


For the CapturesBefore tracker, it is sufficient to check that
I can not reach BeforeHere. This does not necessarily require
that BeforeHere dominates I, it can also occur if the capture
happens on an entirely disjoint path.

This change was previously accepted in D90688, but had to be
reverted due to large compile-time impact in some cases: It
increases the number of reachability queries that are performed.

After recent changes, the compile-time impact is largely mitigated,
so I'm reapplying this patch. The remaining compile-time impact
is largely proportional to changes in code-size.

2 days ago[Matrix] Fix some newpm check lines, which fail on some bots. (2)
Florian Hahn [Sun, 16 May 2021 13:11:09 +0000 (14:11 +0100)]
[Matrix] Fix some newpm check lines, which fail on some bots. (2)

2 days ago[X86][SSE] Pull out combineToHorizontalAddSub helper from inside (F)ADD/SUB combines...
Simon Pilgrim [Sun, 16 May 2021 09:53:04 +0000 (10:53 +0100)]
[X86][SSE] Pull out combineToHorizontalAddSub helper from inside (F)ADD/SUB combines (REAPPLIED). NFCI.

The intention is to be able to run this from additional locations (such as shuffle combining) in the future.

Reapplies rGb95a103808ac (after reversion at rGc012a388a15b), with SSE3/SSSE3 typo fix, test added at rG0afb10de1449.

2 days ago[Matrix] Fix some newpm check lines, which fail on some bots.
Florian Hahn [Sun, 16 May 2021 12:47:40 +0000 (13:47 +0100)]
[Matrix] Fix some newpm check lines, which fail on some bots.

2 days ago[Matrix] Extend test to also check new PM pipeline.
Florian Hahn [Sun, 16 May 2021 12:08:51 +0000 (13:08 +0100)]
[Matrix] Extend test to also check new PM pipeline.

2 days ago[PhaseOrdering] Add test for insert/extract code for matrixes.
Florian Hahn [Sun, 16 May 2021 10:45:30 +0000 (11:45 +0100)]
[PhaseOrdering] Add test for insert/extract code for matrixes.

2 days ago[VectorCombine] Add tests with and & urem guaranteeing idx is valid.
Florian Hahn [Sun, 16 May 2021 10:12:55 +0000 (11:12 +0100)]
[VectorCombine] Add tests with and & urem guaranteeing idx is valid.

2 days ago[NFC][X86][Costmodel] Add tests for load/store with i1 element type
Roman Lebedev [Sun, 16 May 2021 10:58:07 +0000 (13:58 +0300)]
[NFC][X86][Costmodel] Add tests for load/store with i1 element type

2 days agoRevert "[CaptureTracking] Do not check domination"
Nikita Popov [Sun, 16 May 2021 09:04:45 +0000 (11:04 +0200)]
Revert "[CaptureTracking] Do not check domination"

This reverts commit 6b8b43e7af3074124e3c9e429e1fb08165799be4.

This causes clang test to fail (CodeGenObjC/synchronized.m).
Revert until I can figure out whether that's an expected change.

2 days ago[CaptureTracking] Do not check domination
Nikita Popov [Sun, 16 May 2021 08:40:02 +0000 (10:40 +0200)]
[CaptureTracking] Do not check domination

For the CapturesBefore tracker, it is sufficient to check that
I can not reach BeforeHere. This does not necessarily require
that BeforeHere dominates I, it can also occur if the capture
happens on an entirely disjoint path.

This change was previously accepted in D90688, but had to be
reverted due to large compile-time impact in some cases: It
increases the number of reachability queries that are performed.

After recent changes, the compile-time impact is largely mitigated,
so I'm reapplying this patch. The remaining compile-time impact
is largely proportional to changes in code-size.

2 days ago[MemCpyOpt] Add test for unreachable capture (NFC)
Nikita Popov [Sun, 16 May 2021 08:35:30 +0000 (10:35 +0200)]
[MemCpyOpt] Add test for unreachable capture (NFC)

This is based on the test from D90688, without the argmemonly
attribute. The argmemonly attribute would guaranteed no modref
by itself and the question of captures would not arise in the
first place.

2 days ago[MLIR][PYTHON] Provide opt level for ExecutionEngine Python binding
Uday Bondhugula [Wed, 5 May 2021 02:44:31 +0000 (08:14 +0530)]
[MLIR][PYTHON] Provide opt level for ExecutionEngine Python binding

Provide an option to specify optimization level when creating an
ExecutionEngine via the MLIR JIT Python binding. Not only is the
specified optimization level used for code generation, but all LLVM
optimization passes at the optimization level are also run prior to
machine code generation (akin to the mlir-cpu-runner tool).

Default opt level continues to remain at level two (-O2).

Contributions in part from Prashant Kumar <prashantk@polymagelabs.com>
as well.

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

2 days ago[Matrix] Implement static cast for matrix types
Saurabh Jha [Sun, 9 May 2021 07:17:10 +0000 (08:17 +0100)]
[Matrix] Implement static cast for matrix types

This patch implements static casts for matrix types. This patch finishes all the work needed for https://bugs.llvm.org/show_bug.cgi?id=47141

Reviewed By: fhahn

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

2 days ago[MLIR][NFC] Fix clang-tidy warnings in IntegerSet.h
Uday Bondhugula [Sun, 16 May 2021 06:55:25 +0000 (12:25 +0530)]
[MLIR][NFC] Fix clang-tidy warnings in IntegerSet.h

Fix clang-tidy warnings and some comments in IntegerSet.h. NFC.

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

2 days ago[AIX][compiler-rt] Build and install standalone libatomic
Kai Luo [Sun, 16 May 2021 05:03:10 +0000 (05:03 +0000)]
[AIX][compiler-rt] Build and install standalone libatomic

On AIX, we have to ship `libatomic.a` for compatibility. First, a new `clang_rt.atomic` is added. Second, use added cmake modules for AIX, we are able to build a compatible libatomic.a for AIX. The second step can't be perfectly implemented with cmake now since AIX's archive approach is kinda unique, i.e., archiving shared libraries into a static archive file.

Reviewed By: jsji

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

2 days ago[AIX][AsmPrinter] Print Global Variable in comments
Jinsong Ji [Sun, 16 May 2021 03:04:44 +0000 (03:04 +0000)]
[AIX][AsmPrinter] Print Global Variable in comments

The default AsmPrinter print GV in comments,
AIX should do so too.

This also fix LLVM :: CodeGen/Generic/inline-asm-mem-clobber.ll.

Reviewed By: hubert.reinterpretcast

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

2 days ago[AIX][clang-repl][test] Mark unsupported pending XCOFF64 integrated-as
Hubert Tong [Sun, 16 May 2021 02:38:42 +0000 (22:38 -0400)]
[AIX][clang-repl][test] Mark unsupported pending XCOFF64 integrated-as

This patch replaces the `powerpc64` token with the `system-aix` one in
the UNSUPPORTED line of a test. The `powerpc64` token was originally
added temporarily in 71a0609a2b53.

If AIX uses integrated-as by default and it works both for 32-bit and
64-bit objects, then the issues encountered so far (see comments in
D96033) would be mostly solved.

As it is, marking the test as expected-to-fail (as opposed to
unsupported) on AIX might cause more trouble in the form of 32-bit
versus 64-bit differences. I am not aware of other situations where LIT
tests are dependent on whether the LLVM build is 64-bit or 32-bit.

Reviewed By: jsji

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

3 days ago[Demangle][Rust] Parse trait definitions
Tomasz Miąsko [Sat, 15 May 2021 21:33:24 +0000 (23:33 +0200)]
[Demangle][Rust] Parse trait definitions

Part of https://reviews.llvm.org/D102549

3 days ago[Demangle][Rust] Parse trait implementations
Tomasz Miąsko [Sat, 15 May 2021 21:25:24 +0000 (23:25 +0200)]
[Demangle][Rust] Parse trait implementations

Part of https://reviews.llvm.org/D102549

3 days ago[Demangle][Rust] Parse inherent implementations
Tomasz Miąsko [Sat, 15 May 2021 21:24:16 +0000 (23:24 +0200)]
[Demangle][Rust] Parse inherent implementations

Part of https://reviews.llvm.org/D102549

3 days ago[Attributor] Call site specific AAValueSimplification and AAIsDead.
Kuter Dinel [Sat, 15 May 2021 16:28:50 +0000 (16:28 +0000)]
[Attributor] Call site specific AAValueSimplification and AAIsDead.

This patch makes it possible to do call site specific deductions
for AAValueSimplification and AAIsDead.

Reviewed By: jdoerfert

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

3 days ago[X86] Remove unused check-prefixes
Simon Pilgrim [Sat, 15 May 2021 21:04:49 +0000 (22:04 +0100)]
[X86] Remove unused check-prefixes

3 days ago[CaptureTracking] Only check reachability for capture candidates
Nikita Popov [Sat, 15 May 2021 17:05:08 +0000 (19:05 +0200)]
[CaptureTracking] Only check reachability for capture candidates

Reachability queries are very expensive, and currently performed
for each instruction we look at, even though most of them will
not lead to a capture and are thus ultimately irrelevant. It is
more efficient to walk a few unnecessary instructions than to
perform unnecessary reachability queries.

Theoretically, this may produce worse results, because the additional
instructions considered may cause us to hit the use count limit
earlier. In practice, this does not appear to be a problem, e.g.
on test-suite O3 we report only one more captured-before with this
change, with no resulting codegen differences.

This makes PointerMayBeCapturedBefore() significantly cheaper in
practice, hopefully allowing it to be used in more places.

3 days ago[X86][SSE] Add SSE3 coverage to PHADD/SUB generation tests
Simon Pilgrim [Sat, 15 May 2021 20:25:34 +0000 (21:25 +0100)]
[X86][SSE] Add SSE3 coverage to PHADD/SUB generation tests

This would have caught the regression identified in rGc012a388a15b.

3 days agoNFC. Refactored DIPrinter for support embedded source.
Alex Orlov [Sat, 15 May 2021 19:01:12 +0000 (23:01 +0400)]
NFC. Refactored DIPrinter for support embedded source.

This patch introduces source loading and pruning functions.
It will allow to use the DWARF embedded source and use the same code for JSON printout.
No functional changes.

Reviewed By: dblaikie

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

3 days ago[Compiler-rt] Downgrade another fatal error to warning
Dan Liew [Sat, 15 May 2021 18:09:34 +0000 (11:09 -0700)]
[Compiler-rt] Downgrade another fatal error to warning

https://reviews.llvm.org/D101681 landed a change to check the testing
configuration which relies on using the `-print-runtime-dir` flag of
clang to determine where the runtime testing library is.

The patch treated not being able to find the path reported by clang
as an error. Unfortunately this seems to break the
`llvm-clang-win-x-aarch64` bot. Either the bot is misconfigured or
clang is reporting a bogus path.

To temporarily unbreak the bot downgrade the fatal error to a warning.
While we're here also print information about the command used to
determine the path to aid debugging.

3 days ago[Compiler-rt] Downgrade fatal error about unsupported test configuration
Dan Liew [Sat, 15 May 2021 17:52:10 +0000 (10:52 -0700)]
[Compiler-rt] Downgrade fatal error about unsupported test configuration
to a warning.

https://reviews.llvm.org/D101681 introduced a check to make sure the
compiler and compiler-rt were using the same library path when
intention is to test the just built libs rather that shipped with the
compiler used for testing.

It seems this broken some bots that are likely misconfigured.

So to unbreak them, for now let's make this a warning so the bot
owners can investigate without breaking their builds.

3 days agoSupport GCC's -fstack-usage flag
Pengxuan Zheng [Wed, 14 Apr 2021 20:54:47 +0000 (13:54 -0700)]
Support GCC's -fstack-usage flag

This patch adds support for GCC's -fstack-usage flag. With this flag, a stack
usage file (i.e., .su file) is generated for each input source file. The format
of the stack usage file is also similar to what is used by GCC. For each
function defined in the source file, a line with the following information is
produced in the .su file.

<source_file>:<line_number>:<function_name> <size_in_byte> <static/dynamic>

"Static" means that the function's frame size is static and the size info is an
accurate reflection of the frame size. While "dynamic" means the function's
frame size can only be determined at run-time because the function manipulates
the stack dynamically (e.g., due to variable size objects). The size info only
reflects the size of the fixed size frame objects in this case and therefore is
not a reliable measure of the total frame size.

Reviewed By: MaskRay

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

3 days agoRevert "[X86][SSE] Pull out combineToHorizontalAddSub helper from inside (F)ADD/SUB...
Nico Weber [Sat, 15 May 2021 16:18:35 +0000 (12:18 -0400)]
Revert "[X86][SSE] Pull out combineToHorizontalAddSub helper from inside (F)ADD/SUB combines. NFCI."

This reverts commit b95a103808acfd8f33290d3e80e28af434454b28.
Makes clang assert very early in a Chromium build. See
for a standalone repro.

3 days ago[ARM] Add an extra memset test showing reverted WLSTP loops. NFC
David Green [Sat, 15 May 2021 15:48:58 +0000 (16:48 +0100)]
[ARM] Add an extra memset test showing reverted WLSTP loops. NFC

3 days ago[X86] X86OptimizeLEAPass::replaceDebugValue - take a copy of the DebugLoc not a refer...
Simon Pilgrim [Sat, 15 May 2021 15:28:20 +0000 (16:28 +0100)]
[X86] X86OptimizeLEAPass::replaceDebugValue - take a copy of the DebugLoc not a reference as it may be deleted.

Fixes msan warning due to rG9ca2c50b3601

3 days ago[X86] X86CmovConverterPass::convertCmovInstsToBranches - take a copy of the DebugLoc...
Simon Pilgrim [Sat, 15 May 2021 15:13:34 +0000 (16:13 +0100)]
[X86] X86CmovConverterPass::convertCmovInstsToBranches - take a copy of the DebugLoc not a reference as it may be deleted.

Fixes msan warning due to rG9ca2c50b3601

3 days agoRevert rG632668c1c0e7dcf97154d2e377491cdc8cb6963c : "[TableGen] TreePatternNode:...
Simon Pilgrim [Sat, 15 May 2021 14:49:14 +0000 (15:49 +0100)]
Revert rG632668c1c0e7dcf97154d2e377491cdc8cb6963c : "[TableGen] TreePatternNode::isIsomorphicTo - early out for matching leafs. NFCI."

Revert premature (and very broken....) experimental commit.

3 days ago[TableGen] TreePatternNode::isIsomorphicTo - early out for matching leafs. NFCI.
Simon Pilgrim [Sat, 15 May 2021 14:34:43 +0000 (15:34 +0100)]
[TableGen] TreePatternNode::isIsomorphicTo - early out for matching leafs. NFCI.

If the leafs are the same then no need to perform DefInit matching.

3 days agoX86SpeculativeLoadHardeningPass::hardenValueInRegister - assert that we have a i8...
Simon Pilgrim [Sat, 15 May 2021 14:13:28 +0000 (15:13 +0100)]
X86SpeculativeLoadHardeningPass::hardenValueInRegister - assert that we have a i8/i16/i32/i64 sized register. NFCI.

Silence static analyzer warning for out-of-range access to the SubRegImms[] array.

3 days agoSampleProfileLoader::inlineHotFunctionsWithPriority - Fix uninitialized variable...
Simon Pilgrim [Sat, 15 May 2021 14:02:52 +0000 (15:02 +0100)]
SampleProfileLoader::inlineHotFunctionsWithPriority - Fix uninitialized variable warning. NFCI.

findIndirectCallFunctionSamples will leave Sum uninitialized if it returns an empty vector, we don't really use Sum in this case (but we do make a copy that isn't used either) - so ensure we initialize the value to zero to at least silence the static analysis warning.

3 days agoIfConverter::MeetIfcvtSizeLimit - Fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Sat, 15 May 2021 13:51:37 +0000 (14:51 +0100)]
IfConverter::MeetIfcvtSizeLimit - Fix uninitialized variable warnings. NFCI.

Ensure the duplication instruction counts are initialized to zero (even though they aren't used) to silence static analysis warnings.

3 days ago[CFG] Move reachable from entry checks into basic block variant
Nikita Popov [Sat, 15 May 2021 11:05:18 +0000 (13:05 +0200)]
[CFG] Move reachable from entry checks into basic block variant

These checks are not specific to the instruction based variant of
isPotentiallyReachable(), they are equally valid for the basic
block based variant. Move them there, to make sure that switching
between the instruction and basic block variants cannot introduce

3 days ago[X86][Atom] Fix vector integer multiplication resource/throughputs
Simon Pilgrim [Sat, 15 May 2021 13:25:48 +0000 (14:25 +0100)]
[X86][Atom] Fix vector integer multiplication resource/throughputs

Match whats documented in the Intel AOM (and Agner/instlatx64 agree) - vector integer multiplies are pipelined - all Port0, throughput = 2 @ 128bits, 1 @ 64bits.

Noticed while checking reduction costs - now that we can use in-order models in llvm-mca, the atom model is the "worst case scenario" we have in x86.

3 days ago[Local] collectBitParts - bail out if we find more than one root input value.
Simon Pilgrim [Sat, 15 May 2021 12:58:42 +0000 (13:58 +0100)]
[Local] collectBitParts - bail out if we find more than one root input value.

All the uses that we have for collectBitParts revolve around us matching down to an operation with a single root value - I don't think we're intending to change that (and a lot of collectBitParts assumes it).

The binops cases (OR/FSHL/FSHR) already check if the providers are the same, but that would still mean we waste time collecting through unaryops before getting to them.

3 days ago[InstCombine] InstCombinerImpl::visitOr - enable bitreverse matching
Simon Pilgrim [Sat, 15 May 2021 12:39:09 +0000 (13:39 +0100)]
[InstCombine] InstCombinerImpl::visitOr - enable bitreverse matching

Currently we only match bswap intrinsics from or(shl(),lshr()) style patterns when we could often match bitreverse intrinsics almost as cheaply.

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

3 days ago[X86] Try to pass DebugLoc by const-ref to avoid costly TrackingMDNodeRef copies...
Simon Pilgrim [Sat, 15 May 2021 12:23:28 +0000 (13:23 +0100)]
[X86] Try to pass DebugLoc by const-ref to avoid costly TrackingMDNodeRef copies (REAPPLIED). NFCI.

Reapply rG5ed56a821c06 (after reverted by rG7aa89c4a22fd) - don't take reference from struct that will be erased in X86FrameLowering::eliminateCallFramePseudoInstr

3 days ago[Local] collectBitParts - early-out from binops. NFCI.
Simon Pilgrim [Fri, 14 May 2021 18:09:33 +0000 (19:09 +0100)]
[Local] collectBitParts - early-out from binops. NFCI.

Minor speedup by not bothering to attempt to collect the second operand's bit parts if we already know its failed in the first operand.

3 days ago[GlobalOpt] add tests for store alignment (PR50253); NFC
Sanjay Patel [Sat, 15 May 2021 11:31:45 +0000 (07:31 -0400)]
[GlobalOpt] add tests for store alignment (PR50253); NFC

3 days ago[GlobalOpt] add test checks; NFC
Sanjay Patel [Sat, 15 May 2021 11:11:16 +0000 (07:11 -0400)]
[GlobalOpt] add test checks; NFC

I'm also adding an explicit data layout, so we can
confirm that alignment requirements/prefs are met.

I tried to use complete/scripted CHECK lines here,
but that fails with 1 of the globals, and not sure why.

3 days ago[IR] Add BasicBlock::isEntryBlock() (NFC)
Nikita Popov [Sat, 15 May 2021 10:38:27 +0000 (12:38 +0200)]
[IR] Add BasicBlock::isEntryBlock() (NFC)

This is a recurring and somewhat awkward pattern. Add a helper
method for it.

3 days ago[clang-format] PR50326 AlignAfterOpenBracket AlwaysBreak does not keep to the Column...
mydeveloperday [Sat, 15 May 2021 10:29:56 +0000 (11:29 +0100)]
[clang-format]  PR50326 AlignAfterOpenBracket AlwaysBreak does not keep to the ColumnLimit


{D93626} caused a regression in terms of formatting a function ptr, incorrectly thinking it was a C-Style cast.

This cased a formatter regression between clang-format-11 and clang-format-12

void bar()
    size_t foo = function(Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong);

    size_t foo = function(
        Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong, BarrrrrrrrrrrrLong,

    size_t foo = (*(function))(Foooo, Barrrrr, Foooo, FoooooooooLooooong);

    size_t foo = (*(
        function))(Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong,
        BarrrrrrrrrrrrLong, FoooooooooLooooong);


void bar()
    size_t foo1 = function(Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong);

    size_t foo2 = function(
        Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong, BarrrrrrrrrrrrLong,

    size_t foo3 = (*(function))(Foooo, Barrrrr, Foooo, FoooooooooLooooong);

    size_t foo4 = (*(
        function))(Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong, BarrrrrrrrrrrrLong, FoooooooooLooooong);

This fixes this issue by simplify the clause to be specific about what is wanted rather than what is not.

Reviewed By: curdeius, HazardyKnusperkeks

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

3 days ago[CFG] Use comesBefore() (NFC)
Nikita Popov [Sat, 15 May 2021 10:14:30 +0000 (12:14 +0200)]
[CFG] Use comesBefore() (NFC)

Use comesBefore() instead of performing an instruction walk. In
line with the previous implementation, instructions are considered
to reach themselves.

3 days ago[CaptureTracking] Clean up same instruction check (NFC)
Nikita Popov [Sat, 15 May 2021 09:57:01 +0000 (11:57 +0200)]
[CaptureTracking] Clean up same instruction check (NFC)

Check the BeforeHere == I case once in shouldExplore, instead of
handling it in four different places.

3 days ago[Demangle][Rust] Parse char constants
Tomasz Miąsko [Fri, 14 May 2021 00:00:00 +0000 (00:00 +0000)]
[Demangle][Rust] Parse char constants

Reviewed By: dblaikie

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

3 days ago[Demangle][Rust] Parse bool constants
Tomasz Miąsko [Fri, 14 May 2021 00:00:00 +0000 (00:00 +0000)]
[Demangle][Rust] Parse bool constants

Reviewed By: dblaikie

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

3 days agoVerifier: second attempt to fix what I broke with swiftasync.
Tim Northover [Sat, 15 May 2021 07:03:43 +0000 (08:03 +0100)]
Verifier: second attempt to fix what I broke with swiftasync.

During a rebase I messed up this array, so trying to put it back to as it was
before with just one SwiftAsync entry.

3 days agoRevert "[Clang,Driver] Add -fveclib=Darwin_libsystem_m support."
Douglas Yung [Sat, 15 May 2021 05:39:12 +0000 (22:39 -0700)]
Revert "[Clang,Driver] Add -fveclib=Darwin_libsystem_m support."

This reverts commit 187a14e1f39942545b905679a8452365dfd87af8.

The test added in this commit is failing on several build bots:


3 days ago[sanitizer] Disable test on Android
Vitaly Buka [Sat, 15 May 2021 05:04:35 +0000 (22:04 -0700)]
[sanitizer] Disable test on Android

readelf needs access to the actual compiled binary, but it's replaced
by a wrapper script.

3 days agoFix "is not used" warning
Vitaly Buka [Sat, 15 May 2021 03:58:12 +0000 (20:58 -0700)]
Fix "is not used" warning

3 days ago[llvm-jitlink] Link libnetwork on Haiku in llvm-jitlink
Lang Hames [Sat, 15 May 2021 03:46:47 +0000 (20:46 -0700)]
[llvm-jitlink] Link libnetwork on Haiku in llvm-jitlink

The system's network API is in libnetwork.so, so we explicitly need to link to
them on Haiku. This patch is similar to https://reviews.llvm.org/D97633.

Patch by Niels Reedijk. Thanks Niels!

Reviewed By: lhames

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

3 days ago[mlir][sparse] remove accidental debug code
Aart Bik [Sat, 15 May 2021 02:26:50 +0000 (19:26 -0700)]
[mlir][sparse] remove accidental debug code

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

3 days ago[gn build] (manually) port ad7e12226f6b
Nico Weber [Sat, 15 May 2021 02:24:39 +0000 (22:24 -0400)]
[gn build] (manually) port ad7e12226f6b

3 days ago[mlir][sparse] prepare runtime support lib for multiple dim level types
Aart Bik [Sat, 15 May 2021 02:11:39 +0000 (19:11 -0700)]
[mlir][sparse] prepare runtime support lib for multiple dim level types

We are moving from just dense/compressed to more general dim level
types, so we need more than just an "i1" array for annotations.

Reviewed By: bixia

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

3 days agoExtract a helper routine to simplify D91481 [NFC]
Philip Reames [Sat, 15 May 2021 01:40:23 +0000 (18:40 -0700)]
Extract a helper routine to simplify D91481 [NFC]

3 days ago[MC] Add the ability to pass MCRegisterInfo to dump_pretty.
Hendrik Greving [Thu, 13 May 2021 15:22:27 +0000 (08:22 -0700)]
[MC] Add the ability to pass MCRegisterInfo to dump_pretty.

Adds the ability to pass MCRegisterInfo to dump_pretty and to the print functions,
so that if present, target specific enums names are printed instead of enum values.

3 days ago[Compiler-rt] Distinguish between testing just built runtime libraries and the librar...
Dan Liew [Fri, 30 Apr 2021 23:24:33 +0000 (16:24 -0700)]
[Compiler-rt] Distinguish between testing just built runtime libraries and the libraries shipped with the compiler.

The path to the runtime libraries used by the compiler under test
is normally identical to the path where just built libraries are
created. However, this is not necessarily the case when doing standalone
builds. This is because the external compiler used by tests may choose
to get its runtime libraries from somewhere else.

When doing standalone builds there are two types of testing we could be

* Test the just built runtime libraries.
* Test the runtime libraries shipped with the compile under test.

Both types of testing are valid but it confusingly turns out compiler-rt
actually did a mixture of these types of testing.

* The `test/builtins/Unit/` test suite always tested the just built runtime
* All other testsuites implicitly use whatever runtime library the
  compiler decides to link.

There is no way for us to infer which type of testing the developer
wants so this patch introduces a new
option which explicitly declares which runtime libraries should be
tested. If it is `ON` then the just built libraries should be tested,
otherwise the libraries in the external compiler should be tested.

When testing starts the lit test suite queries the compiler used for
testing to see where it will get its runtime libraries from.  If these
paths are identical no action is taken (the common case). If the paths
are not identical then we check the value of
`COMPILER_RT_TEST_STANDALONE_BUILD_LIBS` (progated into the config as
`test_standalone_build_libs`) and check if the test suite supports testing in the
requested configuration.

* If we want to test just built libs and the test suite supports it
  (currently only `test/builtins/Unit`) then testing proceeds without any changes.
* If we want to test the just built libs and the test suite doesn't
  support it we emit a fatal error to prevent the developer from
  testing the wrong runtime libraries.
* If we are testing the compiler's built libs then we adjust
  `config.compiler_rt_libdir` to point at the compiler's runtime
  directory. This makes the `test/builtins/Unit` tests use the
  compiler's builtin library. No other changes are required because
  all other testsuites implicitly use the compiler's built libs.

To make the above work the
`test_suite_supports_overriding_runtime_lib_path` test suite config
option has been introduced so we can identify what each test suite

Note all of these checks **have to be performed** when lit runs.
We cannot run the checks at CMake generation time because
multi-configuration build systems prevent us from knowing what the
paths will be.

We could perhaps support `COMPILER_RT_TEST_STANDALONE_BUILD_LIBS` being
`ON` for most test suites (when the runtime library paths differs) in
the future by specifiying a custom compiler resource directory path.
Doing so is out of scope for this patch.


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

3 days ago[GlobalISel][CallLowering] Fix crash when handling a v3s32 type that's being passed...
Amara Emerson [Fri, 14 May 2021 23:21:53 +0000 (16:21 -0700)]
[GlobalISel][CallLowering] Fix crash when handling a v3s32 type that's being passed as v2s64.

3 days ago[lld][WebAssembly] Remove unused method declaration. NFC
Sam Clegg [Fri, 14 May 2021 21:58:00 +0000 (14:58 -0700)]
[lld][WebAssembly] Remove unused method declaration. NFC

This method was removed in https://reviews.llvm.org/D102265
but the declaration was missed.

4 days agoReinstate gtest fix from 4f0b0bf5c6731e3d370558be08c9261801263b09
Benjamin Kramer [Fri, 14 May 2021 22:35:13 +0000 (00:35 +0200)]
Reinstate gtest fix from 4f0b0bf5c6731e3d370558be08c9261801263b09

I missed this when merging gtest 1.10.0, breaking all asan tests :|

4 days ago[LowerConstantIntrinsics] reuse isManifestLogic from ConstantFolding
Nick Desaulniers [Fri, 14 May 2021 19:36:41 +0000 (12:36 -0700)]
[LowerConstantIntrinsics] reuse isManifestLogic from ConstantFolding

GlobalVariables are Constants, yet should not unconditionally be
considered true for __builtin_constant_p.

Via the LangRef

    This intrinsic generates no code. If its argument is known to be a
    manifest compile-time constant value, then the intrinsic will be
    converted to a constant true value. Otherwise, it will be converted
    to a constant false value.

    In particular, note that if the argument is a constant expression
    which refers to a global (the address of which _is_ a constant, but
    not manifest during the compile), then the intrinsic evaluates to

Move isManifestConstant from ConstantFolding to be a method of
Constant so that we can reuse the same logic in


Reviewed By: rsmith, george.burgess.iv

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

4 days ago[libcxx][ranges] Add `contiguous_iterator`.
zoecarver [Tue, 27 Apr 2021 15:53:17 +0000 (08:53 -0700)]
[libcxx][ranges] Add `contiguous_iterator`.

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

4 days ago[compiler-rt] Fix deprection warnings on INSTANTIATE_TEST_CASE_P
Benjamin Kramer [Fri, 14 May 2021 22:24:02 +0000 (00:24 +0200)]
[compiler-rt] Fix deprection warnings on INSTANTIATE_TEST_CASE_P

4 days ago[mlir][Linalg] NFC - More gracefully degrade lookup into failure during comprehensive...
Nicolas Vasilache [Fri, 14 May 2021 16:57:12 +0000 (16:57 +0000)]
[mlir][Linalg] NFC - More gracefully degrade lookup into failure during comprehensive bufferization (4/n)

Differential revsion: https://reviews.llvm.org/D102420

4 days ago[AMDGPU] Update SCC defs to VCC when uses are changed to VCC
Brendon Cahoon [Sat, 8 May 2021 15:05:22 +0000 (11:05 -0400)]
[AMDGPU] Update SCC defs to VCC when uses are changed to VCC

The FixSGPRCopies pass converts instructions to VALU when
removing illegal VGPR to SGPR copies. Instructions that use SCC
are changed to use VCC instead. When that happens, the pass must
also change instructions that define SCC to define VCC.

The pass was not changing the SCC definition when an ADDC is
converted due to a input that is a VGPR to SGPR copy. But, the
initial ADD insruction, which define SCC, is not converted.
This causes a compilation failure due to a use of an undefined
physical register.

This patch adds code that inserts the SCC definition in the
MoveToVALU worklist when a SCC use is converted to a VCC use.

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

4 days ago[msan] [NFC] Add newline to EOF in test.
Mitch Phillips [Fri, 14 May 2021 22:00:00 +0000 (15:00 -0700)]
[msan] [NFC] Add newline to EOF in test.

4 days ago[mlir][Linalg] Add support for subtensor_insert comprehensive bufferization (3/n)
Nicolas Vasilache [Fri, 14 May 2021 16:35:40 +0000 (16:35 +0000)]
[mlir][Linalg] Add support for subtensor_insert comprehensive bufferization (3/n)

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

4 days agoRevert "[X86] Try to pass DebugLoc by const-ref to avoid costly TrackingMDNodeRef...
Mitch Phillips [Fri, 14 May 2021 21:12:21 +0000 (14:12 -0700)]
Revert "[X86] Try to pass DebugLoc by const-ref to avoid costly TrackingMDNodeRef copies. NFCI."

This reverts commit 5ed56a821c0622869739a3ae752eea97a1ee1f48.

Reason: Broke the MSan buildbots. See Phabricator for more info

4 days ago[NFC] Directly get GV type
Arthur Eubanks [Fri, 14 May 2021 21:26:37 +0000 (14:26 -0700)]
[NFC] Directly get GV type

4 days ago[Polly] Run polly-update-format. NFC.
Michael Kruse [Fri, 14 May 2021 21:22:38 +0000 (16:22 -0500)]
[Polly] Run polly-update-format. NFC.

Thanks to Leonard Chan for reporting.

4 days ago[CSSPGO] Fix return value of getProbeWeight
wlei [Thu, 6 May 2021 00:17:05 +0000 (17:17 -0700)]
[CSSPGO] Fix return value of getProbeWeight

Currently we didn't support multiple return type, we work around to use error_code to represent:

1)  The dangling probe.
2)  Ignore the weight of non-probe instruction

While merging the instructions' weight for the whole BB, it will filter out the error code. But If all instructions of the BB give error_code, the outside logic will mark it as a BB requiring the inference algorithm to infer its weight. This is different from the zero value which will be treated as a cold block.

Fix one place that if we can't find the FunctionSamples in the profile data which indicates the BB is cold, we choose to return zero.

Also refine the comments.

Reviewed By: hoy, wenlei

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

4 days ago[MemDep] Use BatchAA in more places (NFCI)
Nikita Popov [Sat, 25 Jul 2020 16:12:40 +0000 (18:12 +0200)]
[MemDep] Use BatchAA in more places (NFCI)

Previously, we already used BatchAA for individual simple pointer
dependency queries. This extends BatchAA usage for the non-local
case, so that only one BatchAA instance is used for all blocks,
instead of one instance per block.

Use of BatchAA is safe as IR cannot be modified during a MemDep

4 days ago[SystemZ] [z/OS] Add SystemZCallingConventionRegisters class
Neumann Hon [Fri, 14 May 2021 20:15:08 +0000 (16:15 -0400)]
[SystemZ] [z/OS] Add SystemZCallingConventionRegisters class

This patch adds the abstract class SystemZCallingConventionRegisters
which is a SystemZ-specific class detailing special registers used
by calling conventions on the target. SystemZELFRegisters and
SystemZXPLINK64Registers implement this class for ELF and XPLINK64

Reviewed By: uweigand

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

4 days ago[LLD][MinGW] Ignore --no-undefined flag
Mateusz Mikuła [Fri, 14 May 2021 20:46:49 +0000 (23:46 +0300)]
[LLD][MinGW] Ignore --no-undefined flag

AFAIK this is the default behaviour when this flag is not passed.

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

4 days ago[MinGW] Always enable -mbig-obj for LLVM build unless using Clang
Mateusz Mikuła [Fri, 14 May 2021 20:45:07 +0000 (23:45 +0300)]
[MinGW] Always enable -mbig-obj for LLVM build unless using Clang

It's easy to hit 2**16 limit with i686 GNU toolchains these days.
Clang does it automagically, so it's not needed there, and the option
causes warnings about being unused when linking.

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

4 days ago[Scudo] Delete unused flag 'rss_limit_mb'.
Mitch Phillips [Fri, 14 May 2021 20:45:29 +0000 (13:45 -0700)]
[Scudo] Delete unused flag 'rss_limit_mb'.


Reviewed By: cryptoad

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

4 days ago[LV] Add another more complex first-order recurrence sinking test.
Florian Hahn [Fri, 14 May 2021 20:19:29 +0000 (21:19 +0100)]
[LV] Add another more complex first-order recurrence sinking test.

4 days ago[Clang,Driver] Add -fveclib=Darwin_libsystem_m support.
Florian Hahn [Fri, 14 May 2021 20:00:13 +0000 (21:00 +0100)]
[Clang,Driver] Add -fveclib=Darwin_libsystem_m support.

Support for Darwin's libsystem_m's vector functions has been added to
LLVM in 93a9a8a8d90f.

This patch adds support for -fveclib=Darwin_libsystem_m to Clang.

Reviewed By: arphaman

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

4 days ago[AA] Support callCapturesBefore() on BatchAA (NFCI)
Nikita Popov [Thu, 13 May 2021 19:45:46 +0000 (21:45 +0200)]
[AA] Support callCapturesBefore() on BatchAA (NFCI)

This is not expected to have any practical compile-time effect,
as the alias() calls inside callCapturesBefore() are rare. This
should still be supported for API completeness, and might be
useful for reachability caching.

4 days ago[SLP][NFC]Add a test for non-consecutive inserts, NFC.
Alexey Bataev [Fri, 14 May 2021 19:44:06 +0000 (12:44 -0700)]
[SLP][NFC]Add a test for non-consecutive inserts, NFC.

4 days ago[sanitizer] Commit a missing change in BufferedStackTrace::Unwind
Fangrui Song [Fri, 14 May 2021 19:41:34 +0000 (12:41 -0700)]
[sanitizer] Commit a missing change in BufferedStackTrace::Unwind

4 days ago[sanitizer] Fall back to fast unwinder
Fangrui Song [Fri, 14 May 2021 19:27:33 +0000 (12:27 -0700)]
[sanitizer] Fall back to fast unwinder

`-fno-exceptions -fno-asynchronous-unwind-tables` compiled programs don't
produce .eh_frame on Linux and other ELF platforms, so the slow unwinder cannot
print stack traces. Just fall back to the fast unwinder: this allows
-fno-asynchronous-unwind-tables without requiring the sanitizer option

Reviewed By: #sanitizers, vitalybuka

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

4 days agoGTEST_HAS_TR1_TUPLE is gone, stop defining it.
Benjamin Kramer [Fri, 14 May 2021 19:13:18 +0000 (21:13 +0200)]
GTEST_HAS_TR1_TUPLE is gone, stop defining it.

4 days ago[ProfData] Address a unit test FIXME
Benjamin Kramer [Fri, 14 May 2021 19:12:59 +0000 (21:12 +0200)]
[ProfData] Address a unit test FIXME

4 days agoRemove (unneeded) '-asan-use-after-return' from hoist-argument-init-insts.ll.
Kevin Athey [Thu, 13 May 2021 22:07:21 +0000 (15:07 -0700)]
Remove (unneeded) '-asan-use-after-return' from hoist-argument-init-insts.ll.

Remove (unneeded) '-asan-use-after-return' from hoist-argument-init-insts.ll.

Reviewed By: vsk

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