Changes

Summary

  1. Revert "[llvm] Add interface to order inlining" (details)
  2. SmallVector.h - remove unused MathExtras.h header (REAPPLIED). NFCI. (details)
  3. Revert rG0b18c4c0ec03f0321ee83b9976da5777d0e4f53f "SmallVector.h - remove unused MathExtras.h header (REAPPLIED). NFCI." (details)
  4. DirectoryWatcher-linux.cpp - add missing implicit MathExtras.h header dependency. NFCI. (details)
  5. LibcBenchmark.h - add missing implicit cmath header dependency. NFCI. (details)
  6. Fix uninitialized variable warnings. NFCI. (details)
  7. SmallVector.h - remove unused MathExtras.h header. NFCI. (details)
  8. BPFISelDAGToDAG.cpp - don't dereference a dyn_cast<> result. NFCI. (details)
  9. PatternMatch.h - wrap WrapFlags tests inside brackets to stop static analysis warning about & vs && usage. NFCI. (details)
  10. Fix implicit fall through compiler warning. NFCI. (details)
  11. BreadthFirstIterator.h - fix uninitialized variable warning in default constructor. NFCI. (details)
  12. SimplifyCFG.cpp - remove dead early-return code added at rGcc63203908da. NFCI. (details)
  13. [CodeGen] Add missing includes (NFC) (details)
  14. [TargetLowering] Move methods out of line (NFC) (details)
  15. [Clang][OpenMP] Add static version of getSingleClause<ClauseT>. NFC. (details)
  16. AssumeBundleQueries.cpp - don't dereference a dyn_cast<> result. NFCI. (details)
  17. X86Operand.h - fix uninitialized variable warnings in constructor. NFCI. (details)
  18. [LexicalScopesTest] Add missing IRBuilder.h include (NFC) (details)
  19. [TargetLowering] Use IRBuilderBase instead of IRBuilder<> (NFC) (details)
  20. X86MachObjectWriter.cpp - silence null deference warnings. NFCI. (details)
  21. [Clang][OpenMP] Refactor checking for mutually exclusive clauses. NFC. (details)
  22. Revert "[LoopUnrollAndJam] Change LoopUnrollAndJamPass to LoopNest pass" (details)
  23. [X86][SSE] combineVectorTruncation - simplify PSHUFB-is-better logic. NFCI. (details)
  24. [X86][SSE] LowerFP_TO_INT - remove dead code. NFCI. (details)
  25. [RISCV] Replace && with ||. Spotted by coverity. (details)
  26. [CostModel][X86] Improve AVX512 FDIV costs (details)
  27. [AArch64] Extra tests for vector shift. NFC (details)
  28. [ARM] MVE tests for vmull from a splat. NFC (details)
  29. [CostModel][X86] Add 512-bit bswap cost tests (details)
  30. [CostModel][X86] Add 512-bit bswap costs (details)
  31. [dfsan] Use the sanitizer allocator to reduce memory cost (details)
  32. [lld/mac] Use fewer magic numbers in magic $ld$ handling code (details)
  33. [lld/mac] Rename DylibFile::dylibName to DylibFile::installName (details)
  34. [lld/mac] Implement support for searching dylibs with @executable_path/ in install name (details)
  35. [lld/mac] Implement support for searching dylibs with @loader_path/ in install name (details)
  36. [yaml2obj] Initial the support of yaml2obj for 32-bit XCOFF. (details)
Commit 48252d7570bdf5ab77451d0f049047f1c40742dd by taolq
Revert "[llvm] Add interface to order inlining"
The file was modifiedllvm/lib/Transforms/IPO/Inliner.cpp
Commit 0b18c4c0ec03f0321ee83b9976da5777d0e4f53f by llvm-dev
SmallVector.h - remove unused MathExtras.h header (REAPPLIED). NFCI.

Try again to remove this header - I think I've found the implicit dependencies (mainly for <cmath>) on linux builds now.
The file was modifiedllvm/include/llvm/ADT/SmallVector.h
Commit b47a7bb7031bf9dbe280f8bbdf8debae02187248 by llvm-dev
Revert rG0b18c4c0ec03f0321ee83b9976da5777d0e4f53f "SmallVector.h - remove unused MathExtras.h header (REAPPLIED). NFCI."

Buildbots still seem to find implicit header dependencies that I can't locally....
The file was modifiedllvm/include/llvm/ADT/SmallVector.h
Commit 72390f0c28dddffc53c20ba0ec765b8de4e05383 by llvm-dev
DirectoryWatcher-linux.cpp - add missing implicit MathExtras.h header dependency. NFCI.
The file was modifiedclang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
Commit c2ab3d2c85c8af4483f05d8bb702891cd3682969 by llvm-dev
LibcBenchmark.h - add missing implicit cmath header dependency. NFCI.

Noticed while investigating if we can remove an unnecessary MathExtras.h include from SmallVector.h
The file was modifiedlibc/benchmarks/LibcBenchmark.h
Commit c18df1e1569c8a0ecfd89c9879332f5c6bb95bf9 by llvm-dev
Fix uninitialized variable warnings. NFCI.
The file was modifiedllvm/include/llvm/Transforms/IPO/IROutliner.h
Commit 139a36454f842c7936ba461279e862488e894637 by llvm-dev
SmallVector.h - remove unused MathExtras.h header. NFCI.
The file was modifiedllvm/include/llvm/ADT/SmallVector.h
Commit ab2d29555293f6bde7096e1f684a1957ee9f9c92 by llvm-dev
BPFISelDAGToDAG.cpp - don't dereference a dyn_cast<> result. NFCI.

Use cast<> instead which will assert that the cast is correct and not just return null.

Fixes static analysis warnings.
The file was modifiedllvm/lib/Target/BPF/BPFISelDAGToDAG.cpp
Commit 6e90192fdfef17d48d26a0fba067410e36d9e636 by llvm-dev
PatternMatch.h - wrap WrapFlags tests inside brackets to stop static analysis warning about & vs && usage. NFCI.
The file was modifiedllvm/include/llvm/IR/PatternMatch.h
Commit 937c4cffd02420607ada23d3d25078df9bf553cb by llvm-dev
Fix implicit fall through compiler warning. NFCI.
The file was modifiedllvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
Commit 5fc8cdcb03e380e6193464eef499d373dcde3708 by llvm-dev
BreadthFirstIterator.h - fix uninitialized variable warning in default constructor. NFCI.
The file was modifiedllvm/include/llvm/ADT/BreadthFirstIterator.h
Commit 9ced408fe97478309cb19ca241009ade4ad6315c by llvm-dev
SimplifyCFG.cpp - remove dead early-return code added at rGcc63203908da. NFCI.

We've already checked that ScanIdx == 0 a few lines above.
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
Commit 99142003933c19d7d91e1c89fe038876cf429e4a by nikita.ppv
[CodeGen] Add missing includes (NFC)

These currently rely on the IRBuilder.h include in TargetLowering.h.
Make them explicit.
The file was modifiedllvm/lib/Target/AArch64/AArch64StackTagging.cpp
The file was modifiedllvm/lib/Target/RISCV/RISCVISelLowering.cpp
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUPerfHintAnalysis.cpp
The file was modifiedllvm/lib/Target/AMDGPU/SIISelLowering.cpp
The file was modifiedllvm/lib/Target/Hexagon/HexagonISelLowering.cpp
The file was modifiedllvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
The file was modifiedllvm/lib/CodeGen/InterleavedLoadCombinePass.cpp
The file was modifiedllvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
Commit 506875c87926b8009664ffc15a1f8233e8460cde by nikita.ppv
[TargetLowering] Move methods out of line (NFC)

Move methods using IRBuilder out of line, so we can drop the
dependency on the header.
The file was modifiedllvm/include/llvm/CodeGen/TargetLowering.h
The file was modifiedllvm/lib/CodeGen/TargetLoweringBase.cpp
Commit d466ca087aae958d1c0a965c561be07d2cb3e7e2 by llvm-project
[Clang][OpenMP] Add static version of getSingleClause<ClauseT>. NFC.

The current method getSingleClause requires an instance of OMPExecutableDirective to be called. Introduce a static version taking a list of clauses as argument instead that can be used during parsing/Sema before any OMPExecutableDirective has been created.

This is the same approach as taken for getClausesOfKind for getting more more than a single clause of a type which also has a method and static version. NFC patch extracted out of D99459 by request.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D103665
The file was modifiedclang/include/clang/AST/StmtOpenMP.h
Commit 76a1be05fa00638532bfda02839f1847ab15ede7 by llvm-dev
AssumeBundleQueries.cpp - don't dereference a dyn_cast<> result. NFCI.

Use cast<> instead which will assert that the cast is correct and not just return null - the match() should have already failed if the cast isn't valid anyhow.

Fixes static analysis warning.
The file was modifiedllvm/lib/Analysis/AssumeBundleQueries.cpp
Commit 0f938a6ed8f43a8b3923208131ce9c28f723d45f by llvm-dev
X86Operand.h - fix uninitialized variable warnings in constructor. NFCI.
The file was modifiedllvm/lib/Target/X86/AsmParser/X86Operand.h
Commit 85dfb377dd2bba4e88bec049a4ced3d2ba5e34ca by nikita.ppv
[LexicalScopesTest] Add missing IRBuilder.h include (NFC)

This currently depends on a transitive include via TargetLowering.h.
The file was modifiedllvm/unittests/CodeGen/LexicalScopesTest.cpp
Commit 1ffa6499ea3b7fde687666a45e89909fbf72a450 by nikita.ppv
[TargetLowering] Use IRBuilderBase instead of IRBuilder<> (NFC)

Don't require a specific kind of IRBuilder for TargetLowering hooks.
This allows us to drop the IRBuilder.h include from TargetLowering.h.

Differential Revision: https://reviews.llvm.org/D103759
The file was modifiedllvm/lib/Target/PowerPC/PPCISelLowering.h
The file was modifiedllvm/lib/Target/ARM/ARMISelLowering.cpp
The file was modifiedllvm/lib/Target/RISCV/RISCVISelLowering.cpp
The file was modifiedllvm/lib/Target/AArch64/AArch64ISelLowering.h
The file was modifiedllvm/lib/Target/Hexagon/HexagonISelLowering.cpp
The file was modifiedllvm/lib/Target/PowerPC/PPCISelLowering.cpp
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.h
The file was modifiedllvm/include/llvm/CodeGen/TargetLowering.h
The file was modifiedllvm/lib/CodeGen/TargetLoweringBase.cpp
The file was modifiedllvm/lib/Target/AArch64/AArch64ISelLowering.cpp
The file was modifiedllvm/lib/Target/ARM/ARMISelLowering.h
The file was modifiedllvm/lib/Target/Hexagon/HexagonISelLowering.h
The file was modifiedllvm/lib/Target/RISCV/RISCVISelLowering.h
Commit b69e16b5cce6987dd9da3570c1b97e4b7e437d85 by llvm-dev
X86MachObjectWriter.cpp - silence null deference warnings. NFCI.

The MCSymbol data should always be present for non-absolute sections so assert that it is to silence static analysis warnings.
The file was modifiedllvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp
Commit c41a8fbfbb096995367947e5ef7d36501b04d493 by llvm-project
[Clang][OpenMP] Refactor checking for mutually exclusive clauses. NFC.

Multiple clauses are mutually exclusive. This patch refactors the functions that check for pairs of mutually exclusive clauses into a generalized function which also also accepts a list of clause types if which at most one can appear.

NFC patch extracted out of D99459 by request.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D103666
The file was modifiedclang/lib/Sema/SemaOpenMP.cpp
Commit 0a9d0799316c7a601a0b20a123bd99922ac6455b by konndennsa
Revert "[LoopUnrollAndJam] Change LoopUnrollAndJamPass to LoopNest pass"

This reverts commit 21653600034084e8335374ddc1eb8d362158d9a8.

To fix the crash problem in legacy pass manager
The file was modifiedllvm/lib/Transforms/Scalar/LoopUnrollAndJamPass.cpp
The file was modifiedllvm/lib/Passes/PassBuilder.cpp
The file was modifiedllvm/test/Transforms/LoopUnrollAndJam/innerloop.ll
The file was modifiedllvm/lib/Passes/PassRegistry.def
The file was modifiedllvm/include/llvm/Transforms/Scalar/LoopUnrollAndJamPass.h
The file was modifiedllvm/include/llvm/Transforms/Scalar/LoopPassManager.h
Commit 4879c8f3b06eebb498c28c3d2aa6bc0f3f9b961e by llvm-dev
[X86][SSE] combineVectorTruncation - simplify PSHUFB-is-better logic. NFCI.

OutSVT is guaranteed to be i8/i16 and we accept any InSVT that isn't i64
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
Commit 8ab8b3fad7a6e08452e30aaa3a75d6ec89ca5bf2 by llvm-dev
[X86][SSE] LowerFP_TO_INT - remove dead code. NFCI.

Non-Strict v2f32->v2i64 cases have already early-returned to be handled by legalization.
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
Commit 8bde5f06a11d2ed30cc14b4960548d8da7a167b8 by craig.topper
[RISCV] Replace && with ||. Spotted by coverity.

We should be exiting when the shift amount is greater than
the bit width regardless of whether it is a power of 2.

Reported by Simon Pilgrim here https://reviews.llvm.org/D96661

This requires getting a shift amount that is out of bounds that
wasn't already optimized by SelectionDAG. This would be pretty
trick to construct a test for.

Or it would require a non-power of 2 shift amount and a mask
that has runs of ones and zeros of the next lowest power of 2 from
that shift amount. I tried a little to produce a test for this,
but didn't get it to work.
The file was modifiedllvm/lib/Target/RISCV/RISCVISelLowering.cpp
Commit ae973380c5f6be77ce395022be40350942260be9 by llvm-dev
[CostModel][X86] Improve AVX512 FDIV costs

Add missing v16f32/v8f64 costs and adjust other costs as well based off the SkylakeServer model
The file was modifiedllvm/lib/Target/X86/X86TargetTransformInfo.cpp
The file was modifiedllvm/test/Transforms/PhaseOrdering/X86/vdiv.ll
The file was modifiedllvm/test/Analysis/CostModel/X86/arith-fp.ll
Commit 8f8273c54db930badd721a932e3e150f812bd5ca by david.green
[AArch64] Extra tests for vector shift. NFC
The file was addedllvm/test/CodeGen/AArch64/neon-shift-neg.ll
Commit c85766f79b2e2ebdb2a33e3456936cec11b10dc5 by david.green
[ARM] MVE tests for vmull from a splat. NFC
The file was addedllvm/test/CodeGen/Thumb2/mve-vmull-splat.ll
Commit ed3b3cfeb9ea7a80d30225a06a9851b84b5138a6 by llvm-dev
[CostModel][X86] Add 512-bit bswap cost tests
The file was modifiedllvm/test/Analysis/CostModel/X86/bswap-vec.ll
Commit 432eff22ab53820d1c74ad5f7b034a2db950b9fd by llvm-dev
[CostModel][X86] Add 512-bit bswap costs
The file was modifiedllvm/test/Analysis/CostModel/X86/bswap-vec.ll
The file was modifiedllvm/lib/Target/X86/X86TargetTransformInfo.cpp
Commit 2c82588dacac52ba8168214c6814ce22277d6e88 by jianzhouzh
[dfsan] Use the sanitizer allocator to reduce memory cost

dfsan does not use sanitizer allocator as others. In practice,
we let it use glibc's allocator since tcmalloc needs more work
to be working with dfsan well. With glibc, we observe large
memory leakage. This could relate to two things:

1) glibc allocator has limitation: for example, tcmalloc can reduce memory footprint 2x easily

2) glibc may call unmmap directly as an internal system call by using system call number. so DFSan has no way to release shadow spaces for those unmmap.

Using sanitizer allocator addresses the above issues
1) its memory management is close to tcmalloc

2) we can register callback when sanitizer allocator calls unmmap, so dfsan can release shadow spaces correctly.

Our experiment with internal server-based application proved that with the change, in a-few-day run, memory usage leakage is close to what tcmalloc does w/o dfsan.

This change mainly follows MSan's code.

1) define allocator callbacks at dfsan_allocator.h|cpp

2) mark allocator APIs to be discard

3) intercept allocator APIs

4) make dfsan_set_label consistent with MSan's SetShadow when setting 0 labels, define dfsan_release_meta_memory when unmap is called

5) add flags about whether zeroing memory after malloc/free. dfsan works at byte-level, so bit-level oparations can cause reading undefined shadow. See D96842. zeroing memory after malloc helps this. About zeroing after free, reading after free is definitely UB, but if user code does so, it is hard to debug an overtainting caused by this w/o running MSan. So we add the flag to help debugging.

This change will be split to small changes for review. Before that, a question is
"this code shares a lot of with MSan, for example, dfsan_allocator.* and dfsan_new_delete.*.
Does it make sense to unify the code at sanitizer_common? will that introduce some
maintenance issue?"

Reviewed By: morehouse

Differential Revision: https://reviews.llvm.org/D101204
The file was modifiedcompiler-rt/lib/dfsan/dfsan.h
The file was modifiedcompiler-rt/lib/dfsan/dfsan_interceptors.cpp
The file was modifiedcompiler-rt/test/dfsan/custom.cpp
The file was modifiedcompiler-rt/lib/dfsan/dfsan_custom.cpp
The file was modifiedcompiler-rt/lib/dfsan/done_abilist.txt
The file was modifiedcompiler-rt/lib/dfsan/CMakeLists.txt
The file was modifiedcompiler-rt/lib/dfsan/dfsan.cpp
The file was addedcompiler-rt/lib/dfsan/dfsan_new_delete.cpp
The file was addedcompiler-rt/test/dfsan/interceptors.c
Commit e91043744346babdeb1e57e8f46e5a7c8a98fbfb by thakis
[lld/mac] Use fewer magic numbers in magic $ld$ handling code

Also simply a conditional and de-alias a variable.
Minor cleanups, no behavior change.

Differential Revision: https://reviews.llvm.org/D103774
The file was modifiedlld/MachO/InputFiles.cpp
Commit 7def700667ec587e01c5cf7fbc6d31e613d1b801 by thakis
[lld/mac] Rename DylibFile::dylibName to DylibFile::installName

The flag to set it is called `-install_name`, and it's called `installName` in tbd files.

No behavior change.

Differential Revision: https://reviews.llvm.org/D103776
The file was modifiedlld/MachO/InputFiles.h
The file was modifiedlld/MachO/InputFiles.cpp
The file was modifiedlld/MachO/Writer.cpp
Commit a48bd587f7d28ce71b8d7ba6f0fb6499072acf40 by thakis
[lld/mac] Implement support for searching dylibs with @executable_path/ in install name

Differential Revision: https://reviews.llvm.org/D103775
The file was modifiedlld/MachO/InputFiles.cpp
The file was addedlld/test/MachO/link-search-at-executable-path.s
Commit 52489021cf8ba7bb3b8e5ae56ab5f25ce4790c0f by thakis
[lld/mac] Implement support for searching dylibs with @loader_path/ in install name

Differential Revision: https://reviews.llvm.org/D103779
The file was modifiedlld/MachO/InputFiles.cpp
The file was addedlld/test/MachO/link-search-at-loader-path.s
Commit 50bb1b930dbce6ac2bd6af599f2e2a7d00f36ea5 by esme.yi
[yaml2obj] Initial the support of yaml2obj for 32-bit XCOFF.

Summary: The patch implements the mapping of the Yaml
information to XCOFF object file to enable the yaml2obj
tool for XCOFF. Currently only 32-bit is supported.

Reviewed By: jhenderson, shchenz

Differential Revision: https://reviews.llvm.org/D95505
The file was modifiedllvm/lib/ObjectYAML/ObjectYAML.cpp
The file was addedllvm/test/tools/yaml2obj/XCOFF/basic-doc.yaml
The file was modifiedllvm/utils/gn/secondary/llvm/lib/ObjectYAML/BUILD.gn
The file was modifiedllvm/lib/ObjectYAML/XCOFFYAML.cpp
The file was modifiedllvm/include/llvm/BinaryFormat/XCOFF.h
The file was modifiedllvm/lib/ObjectYAML/yaml2obj.cpp
The file was addedllvm/test/tools/yaml2obj/XCOFF/full-contents.yaml
The file was modifiedllvm/include/llvm/ObjectYAML/yaml2obj.h
The file was modifiedllvm/include/llvm/ObjectYAML/ObjectYAML.h
The file was modifiedllvm/lib/ObjectYAML/CMakeLists.txt
The file was modifiedllvm/include/llvm/ObjectYAML/XCOFFYAML.h
The file was addedllvm/lib/ObjectYAML/XCOFFEmitter.cpp