Changes

Summary

  1. Verifier: second attempt to fix what I broke with swiftasync. (details)
  2. [Demangle][Rust] Parse bool constants (details)
  3. [Demangle][Rust] Parse char constants (details)
  4. [CaptureTracking] Clean up same instruction check (NFC) (details)
  5. [CFG] Use comesBefore() (NFC) (details)
  6. [clang-format]  PR50326 AlignAfterOpenBracket AlwaysBreak does not keep to the ColumnLimit (details)
  7. [IR] Add BasicBlock::isEntryBlock() (NFC) (details)
  8. [GlobalOpt] add test checks; NFC (details)
  9. [GlobalOpt] add tests for store alignment (PR50253); NFC (details)
  10. [Local] collectBitParts - early-out from binops. NFCI. (details)
  11. [X86] Try to pass DebugLoc by const-ref to avoid costly TrackingMDNodeRef copies (REAPPLIED). NFCI. (details)
  12. [InstCombine] InstCombinerImpl::visitOr - enable bitreverse matching (details)
  13. [Local] collectBitParts - bail out if we find more than one root input value. (details)
  14. [X86][Atom] Fix vector integer multiplication resource/throughputs (details)
  15. [CFG] Move reachable from entry checks into basic block variant (details)
  16. IfConverter::MeetIfcvtSizeLimit - Fix uninitialized variable warnings. NFCI. (details)
  17. SampleProfileLoader::inlineHotFunctionsWithPriority - Fix uninitialized variable warning. NFCI. (details)
  18. X86SpeculativeLoadHardeningPass::hardenValueInRegister - assert that we have a i8/i16/i32/i64 sized register. NFCI. (details)
  19. [TableGen] TreePatternNode::isIsomorphicTo - early out for matching leafs. NFCI. (details)
  20. Revert rG632668c1c0e7dcf97154d2e377491cdc8cb6963c : "[TableGen] TreePatternNode::isIsomorphicTo - early out for matching leafs. NFCI." (details)
  21. [X86] X86CmovConverterPass::convertCmovInstsToBranches - take a copy of the DebugLoc not a reference as it may be deleted. (details)
  22. [X86] X86OptimizeLEAPass::replaceDebugValue - take a copy of the DebugLoc not a reference as it may be deleted. (details)
  23. [ARM] Add an extra memset test showing reverted WLSTP loops. NFC (details)
  24. Revert "[X86][SSE] Pull out combineToHorizontalAddSub helper from inside (F)ADD/SUB combines. NFCI." (details)
  25. Support GCC's -fstack-usage flag (details)
  26. [Compiler-rt] Downgrade fatal error about unsupported test configuration (details)
  27. [Compiler-rt] Downgrade another fatal error to warning (details)
  28. NFC. Refactored DIPrinter for support embedded source. (details)
  29. [X86][SSE] Add SSE3 coverage to PHADD/SUB generation tests (details)
  30. [CaptureTracking] Only check reachability for capture candidates (details)
  31. [X86] Remove unused check-prefixes (details)
  32. [Attributor] Call site specific AAValueSimplification and AAIsDead. (details)
  33. [Demangle][Rust] Parse inherent implementations (details)
  34. [Demangle][Rust] Parse trait implementations (details)
  35. [Demangle][Rust] Parse trait definitions (details)
  36. [AIX][clang-repl][test] Mark unsupported pending XCOFF64 integrated-as (details)
  37. [AIX][AsmPrinter] Print Global Variable in comments (details)
Commit dbf8cc7b6625ed3547e49b2faecdde3337b1ea6d by Tim Northover
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.
The file was modifiedllvm/lib/IR/Verifier.cpp
Commit fc0f2bb91d01963647392cbba1fe37a6f2d9f3bf by tomasz.miasko
[Demangle][Rust] Parse bool constants

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D102518
The file was modifiedllvm/test/Demangle/rust.test
The file was modifiedllvm/lib/Demangle/RustDemangle.cpp
The file was modifiedllvm/include/llvm/Demangle/RustDemangle.h
Commit 2ba49f6ae611b1dfd1dd64fe0fc4c0143bedc271 by tomasz.miasko
[Demangle][Rust] Parse char constants

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D102524
The file was modifiedllvm/test/Demangle/rust.test
The file was modifiedllvm/lib/Demangle/RustDemangle.cpp
The file was modifiedllvm/include/llvm/Demangle/RustDemangle.h
Commit f765e54db2f1bafeed4cf62fa0d03d66ff13e548 by nikita.ppv
[CaptureTracking] Clean up same instruction check (NFC)

Check the BeforeHere == I case once in shouldExplore, instead of
handling it in four different places.
The file was modifiedllvm/lib/Analysis/CaptureTracking.cpp
Commit 6418bab6f8827960b9d161f5c9c2b8f9702c80e0 by nikita.ppv
[CFG] Use comesBefore() (NFC)

Use comesBefore() instead of performing an instruction walk. In
line with the previous implementation, instructions are considered
to reach themselves.
The file was modifiedllvm/lib/Analysis/CFG.cpp
Commit eae445f65d077304703e3290ddb4ff28f6d65ff4 by mydeveloperday
[clang-format]  PR50326 AlignAfterOpenBracket AlwaysBreak does not keep to the ColumnLimit

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

{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,
        FoooooooooLooooong);

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

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

became

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

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

    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
The file was modifiedclang/unittests/Format/FormatTest.cpp
The file was modifiedclang/lib/Format/TokenAnnotator.cpp
Commit fb9ed1979a712a86c246dc136f8134e8e97a883c by nikita.ppv
[IR] Add BasicBlock::isEntryBlock() (NFC)

This is a recurring and somewhat awkward pattern. Add a helper
method for it.
The file was modifiedllvm/include/llvm/IR/BasicBlock.h
The file was modifiedllvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
The file was modifiedllvm/lib/Transforms/Utils/Local.cpp
The file was modifiedllvm/lib/Analysis/LazyValueInfo.cpp
The file was modifiedllvm/lib/IR/AsmWriter.cpp
The file was modifiedllvm/lib/Analysis/CFG.cpp
The file was modifiedllvm/lib/Transforms/Scalar/LoopDeletion.cpp
The file was modifiedllvm/lib/Transforms/Utils/BasicBlockUtils.cpp
The file was modifiedllvm/lib/Analysis/MemorySSA.cpp
The file was modifiedllvm/lib/Transforms/Scalar/MergeICmps.cpp
The file was modifiedllvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
The file was modifiedllvm/lib/Passes/StandardInstrumentations.cpp
The file was modifiedllvm/lib/Analysis/InstructionSimplify.cpp
The file was modifiedllvm/lib/IR/BasicBlock.cpp
The file was modifiedllvm/lib/Analysis/CaptureTracking.cpp
Commit 6e1a6f65371057224e1c5c79ba51a9916812021e by spatel
[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.
The file was modifiedllvm/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll
Commit 23f7d651b682ea387eaae99f0888e6ca916039cb by spatel
[GlobalOpt] add tests for store alignment (PR50253); NFC
The file was addedllvm/test/Transforms/GlobalOpt/globalsra-align.ll
Commit 28aa7d378abd97cad8e591dd9e9687cda22b0f37 by llvm-dev
[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.
The file was modifiedllvm/lib/Transforms/Utils/Local.cpp
Commit 9ca2c50b3601bbc0f62bc57e00c960f7c10ae54b by llvm-dev
[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
The file was modifiedllvm/lib/Target/X86/X86FrameLowering.cpp
The file was modifiedllvm/lib/Target/X86/X86WinAllocaExpander.cpp
The file was modifiedllvm/lib/Target/X86/X86CallFrameOptimization.cpp
The file was modifiedllvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp
The file was modifiedllvm/lib/Target/X86/X86FloatingPoint.cpp
The file was modifiedllvm/lib/Target/X86/X86PadShortFunction.cpp
The file was modifiedllvm/lib/Target/X86/X86CmovConversion.cpp
The file was modifiedllvm/lib/Target/X86/X86OptimizeLEAs.cpp
Commit 401d6685c0aa20ba97f8311a88004beedf92f3c0 by llvm-dev
[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
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
The file was modifiedllvm/test/Transforms/InstCombine/bitreverse.ll
Commit f0660a977e6822ae68e4c88641d1909b555f0e05 by llvm-dev
[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.
The file was modifiedllvm/lib/Transforms/Utils/Local.cpp
Commit f9b1208681f650eed536648e26b0f9266134b628 by llvm-dev
[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.
The file was modifiedllvm/test/tools/llvm-mca/X86/Atom/resources-sse2.s
The file was modifiedllvm/lib/Target/X86/X86ScheduleAtom.td
The file was modifiedllvm/test/tools/llvm-mca/X86/Atom/resources-ssse3.s
The file was modifiedllvm/test/tools/llvm-mca/X86/Atom/resources-sse1.s
The file was modifiedllvm/test/tools/llvm-mca/X86/Atom/resources-mmx.s
Commit f9e9b0cdb4f499aa8443c21430fdb09a5a74490f by nikita.ppv
[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
regressions.
The file was modifiedllvm/include/llvm/Analysis/CFG.h
The file was modifiedllvm/lib/Analysis/CFG.cpp
The file was modifiedllvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Commit c5fe3839905fe466966d124fb6fc62365ea97636 by llvm-dev
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.
The file was modifiedllvm/lib/CodeGen/IfConversion.cpp
Commit e30540a603ebc9ac4f1cd0c1e94a0755b10ec25f by llvm-dev
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.
The file was modifiedllvm/lib/Transforms/IPO/SampleProfile.cpp
Commit 73635adb86bc51612a55440d8b53d828374c83fc by llvm-dev
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.
The file was modifiedllvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp
Commit 632668c1c0e7dcf97154d2e377491cdc8cb6963c by llvm-dev
[TableGen] TreePatternNode::isIsomorphicTo - early out for matching leafs. NFCI.

If the leafs are the same then no need to perform DefInit matching.
The file was modifiedllvm/utils/TableGen/CodeGenDAGPatterns.cpp
Commit bd7b7ca3eeb6dc530426c19130aa246b96116831 by llvm-dev
Revert rG632668c1c0e7dcf97154d2e377491cdc8cb6963c : "[TableGen] TreePatternNode::isIsomorphicTo - early out for matching leafs. NFCI."

Revert premature (and very broken....) experimental commit.
The file was modifiedllvm/utils/TableGen/CodeGenDAGPatterns.cpp
Commit 2ed89001e14692b52ad728388268e8369e10e05a by llvm-dev
[X86] X86CmovConverterPass::convertCmovInstsToBranches - take a copy of the DebugLoc not a reference as it may be deleted.

Fixes msan warning due to rG9ca2c50b3601
The file was modifiedllvm/lib/Target/X86/X86CmovConversion.cpp
Commit 8cb04d891fba6ee81c385519510cb89e37acea0c by llvm-dev
[X86] X86OptimizeLEAPass::replaceDebugValue - take a copy of the DebugLoc not a reference as it may be deleted.

Fixes msan warning due to rG9ca2c50b3601
The file was modifiedllvm/lib/Target/X86/X86OptimizeLEAs.cpp
Commit aaf2c7b518b3606139171aca3fd030287039cedd by david.green
[ARM] Add an extra memset test showing reverted WLSTP loops. NFC
The file was removedllvm/test/CodeGen/Thumb2/mve-tp-loop.ll
The file was addedllvm/test/CodeGen/Thumb2/mve-memtp-loop.ll
Commit c012a388a15b34c39b53cbfff1b175ac03206dfa by thakis
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
https://bugs.chromium.org/p/chromium/issues/detail?id=1209490#c1
for a standalone repro.
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
Commit c9b36a041fd70de0617ea7e241f520b345e12cac by pzheng
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
The file was modifiedclang/lib/Driver/ToolChains/Clang.cpp
The file was modifiedllvm/include/llvm/CodeGen/AsmPrinter.h
The file was addedclang/test/Driver/stack-usage.c
The file was modifiedclang/lib/CodeGen/BackendUtil.cpp
The file was modifiedclang/lib/Frontend/CompilerInvocation.cpp
The file was modifiedclang/docs/ReleaseNotes.rst
The file was modifiedclang/include/clang/Basic/CodeGenOptions.h
The file was modifiedclang/include/clang/Driver/Options.td
The file was addedclang/test/CodeGen/stack-usage.c
The file was modifiedllvm/include/llvm/Target/TargetOptions.h
The file was modifiedllvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Commit 7085cd2f2945b1e73e1c66f78080c48cba9112e8 by Dan Liew
[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
`COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON`, i.e. the developer's
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.
The file was modifiedcompiler-rt/test/lit.common.cfg.py
Commit b7f60d861ad7a8d03c09c0b72277eabaa53731fb by Dan Liew
[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.
The file was modifiedcompiler-rt/test/lit.common.cfg.py
Commit 88a8965a7d9355438cb6bc60cdeeac12858342c9 by aorlov
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
The file was modifiedllvm/include/llvm/DebugInfo/Symbolize/DIPrinter.h
The file was modifiedllvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
Commit 0afb10de1449f41d026b3784369297cde011f69e by llvm-dev
[X86][SSE] Add SSE3 coverage to PHADD/SUB generation tests

This would have caught the regression identified in rGc012a388a15b.
The file was modifiedllvm/test/CodeGen/X86/haddsub-shuf.ll
Commit 6e9363c94230a8427c11c2d13b7c65164370ffae by nikita.ppv
[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.
The file was modifiedllvm/lib/Analysis/CaptureTracking.cpp
Commit a80a5036a1f6b9a9eb4038b30458f9ab349efff8 by llvm-dev
[X86] Remove unused check-prefixes
The file was modifiedllvm/test/CodeGen/X86/haddsub-shuf.ll
Commit 64ef29bc66aae98efe27553267f1d56a62ee1a4d by kuterdinel
[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
The file was modifiedllvm/lib/Transforms/IPO/AttributorAttributes.cpp
The file was addedllvm/test/Transforms/Attributor/cb_liveness_enabled.ll
The file was modifiedllvm/lib/Transforms/IPO/Attributor.cpp
The file was addedllvm/test/Transforms/Attributor/cb_liveness_disabled.ll
Commit f0f2a8b21cad8f291908ea411c7b38b8c4c8ee42 by tomasz.miasko
[Demangle][Rust] Parse inherent implementations

Part of https://reviews.llvm.org/D102549
The file was modifiedllvm/lib/Demangle/RustDemangle.cpp
The file was modifiedllvm/test/Demangle/rust.test
The file was modifiedllvm/include/llvm/Demangle/RustDemangle.h
Commit 9fa138009f0a818bd2c154f8cd83a98265122714 by tomasz.miasko
[Demangle][Rust] Parse trait implementations

Part of https://reviews.llvm.org/D102549
The file was modifiedllvm/lib/Demangle/RustDemangle.cpp
The file was modifiedllvm/test/Demangle/rust.test
Commit f933f7fbd047802456f9d614daf0f0dfb3c7c45f by tomasz.miasko
[Demangle][Rust] Parse trait definitions

Part of https://reviews.llvm.org/D102549
The file was modifiedllvm/lib/Demangle/RustDemangle.cpp
The file was modifiedllvm/test/Demangle/rust.test
Commit 9ae529d0db2d6841b3b2e49525e03b33e8445636 by hubert.reinterpretcast
[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
The file was modifiedclang/test/Interpreter/execute.cpp
Commit 4b91f96a3e291db1ea6360c9a842ecbc6ee89d67 by Jinsong Ji
[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
The file was modifiedllvm/lib/Target/PowerPC/PPCAsmPrinter.cpp