Changes

Summary

  1. [dfsan][NFC] Fix doc format (details)
  2. Build libSupport with -Werror=global-constructors (NFC) (details)
  3. [Attributor] Introduce getPotentialCopiesOfStoredValue and use it (details)
  4. [Attributor] Delete dead stores (details)
  5. [Local] Do not introduce a new `llvm.trap` before `unreachable` (details)
  6. [CSSPGO] Tweak ICP threshold in top-down inliner (details)
  7. Merge all the llvm-exegesis unit tests into a single binary (details)
  8. [Coroutine] Record the elided coroutines (details)
  9. [Attributor][FIX] Update AMDGPU attributor test (details)
  10. [Attributor] Update check lines for all AMDGPU attributor tests (details)
  11. [OpenMP] Prototype opt-in new GPU device RTL (details)
  12. [InstSimplify] Expose generic interface for replaced operand simplification (details)
  13. [Attributor] Utilize the InstSimplify interface to simplify instructions (details)
Commit 531b19a49e66de5c4b35fc89eebc078c13eb9a85 by jianzhouzh
[dfsan][NFC] Fix doc format
The file was modifiedclang/docs/DataFlowSanitizer.rst
Commit 402461beb051b6a5c158f1e36d8e2c2b676e8804 by joker.eph
Build libSupport with -Werror=global-constructors (NFC)

Ensure that libSupport does not carry any static global initializer.
libSupport can be embedded in use cases where we don't want to load all
cl::opt unless we want to parse the command line.
ManagedStatic can be used to enable lazy-initialization of globals.

The -Werror=global-constructors is only added on platform that have
support for the flag and for which std::mutex does not have a global
destructor. This is ensured by having CMake trying to compile a file
with a global mutex before adding the flag to libSupport.
The file was modifiedcompiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
The file was modifiedllvm/lib/Support/CMakeLists.txt
Commit adddd3dbdae074285f879c5eb7369a92fdd99117 by johannes
[Attributor] Introduce getPotentialCopiesOfStoredValue and use it

This patch introduces `getPotentialCopiesOfStoredValue` which uses
AAPointerInfo to determine all "aliases" or "potential copies" of a
value that is stored into memory. This operation can fail but if it
succeeds it means we can visit all "uses" of a value even if it is
temporarily stored in memory.

There are two users for the function:
  1) `Attributor::checkForAllUses` which will now ignore the value use
     in a store if all "potential copies" can be identified and instead
     be visited. This allows various AAs, including AAPointerInfo
     itself, to look through memory.
  2) `AANoCapture` which uses a custom use tracking through the
     CaptureTracker interface and therefore needs to be thought
     explicitly.

Differential Revision: https://reviews.llvm.org/D106185
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/fp80.ll
The file was modifiedllvm/lib/Transforms/IPO/Attributor.cpp
The file was modifiedllvm/test/Transforms/OpenMP/spmdization.ll
The file was modifiedllvm/test/Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll
The file was modifiedllvm/test/Transforms/Attributor/value-simplify.ll
The file was modifiedllvm/include/llvm/Transforms/IPO/Attributor.h
The file was modifiedllvm/lib/Transforms/IPO/AttributorAttributes.cpp
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/byval-2.ll
The file was modifiedllvm/test/Transforms/Attributor/nodelete.ll
The file was modifiedllvm/test/Transforms/OpenMP/custom_state_machines.ll
Commit 41bd26dff9869a0d72f95ed750a82136f1bccc81 by johannes
[Attributor] Delete dead stores

D106185 allows us to determine if a store is needed easily. Using that
knowledge we can start to delete dead stores.

In AAIsDead we now track more state as an instruction can be dead (= the
old optimisitc state) or just "removable". A store instruction can be
removable while being very much alive, e.g., if it stores a constant
into an alloca or internal global. If we would pretend it was dead
instead of only removablewe we would ignore it when we determine what
values a load can see, so that is not what we want.

Differential Revision: https://reviews.llvm.org/D106188
The file was modifiedllvm/test/Transforms/Attributor/value-simplify-pointer-info.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/byval.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/profile.ll
The file was modifiedllvm/test/Transforms/OpenMP/spmdization.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/alignment.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll
The file was modifiedllvm/lib/Transforms/IPO/AttributorAttributes.cpp
The file was modifiedllvm/test/Transforms/OpenMP/custom_state_machines.ll
The file was modifiedllvm/test/Transforms/Attributor/wrapper.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/control-flow2.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/fp80.ll
The file was modifiedllvm/test/Transforms/Attributor/nodelete.ll
The file was modifiedllvm/include/llvm/Transforms/IPO/Attributor.h
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead_2.ll
The file was modifiedllvm/test/Transforms/Attributor/internal-noalias.ll
The file was modifiedllvm/test/Transforms/Attributor/misc_crash.ll
The file was modifiedllvm/test/Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll
The file was modifiedllvm/test/Transforms/Attributor/value-simplify.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/attrs.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/byval-2.ll
Commit 25a3130d89f00f53a23f7fc38250d5dc43e29cfb by johannes
[Local] Do not introduce a new `llvm.trap` before `unreachable`

This is the second attempt to remove the `llvm.trap` insertion after
https://reviews.llvm.org/rGe14e7bc4b889dfaffb7180d176a03311df2d4ae6
reverted the first one. It is not clear what the exact issue was back
then and it might already be gone by now, it has been >5 years after
all.

Replaces D106299.

Differential Revision: https://reviews.llvm.org/D106308
The file was modifiedllvm/unittests/Transforms/Utils/LocalTest.cpp
The file was modifiedllvm/include/llvm/Transforms/Utils/Local.h
The file was modifiedllvm/lib/Transforms/Utils/Local.cpp
The file was modifiedllvm/test/CodeGen/Hexagon/swp-art-deps-rec.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll
The file was modifiedllvm/lib/CodeGen/WinEHPrepare.cpp
The file was modifiedllvm/test/CodeGen/ARM/vmul.ll
The file was modifiedllvm/lib/Transforms/Coroutines/CoroSplit.cpp
The file was modifiedllvm/lib/Transforms/Utils/InlineFunction.cpp
The file was modifiedllvm/lib/Transforms/Coroutines/Coroutines.cpp
The file was modifiedllvm/lib/Transforms/IPO/PruneEH.cpp
The file was modifiedllvm/test/Transforms/SimplifyCFG/invoke.ll
The file was modifiedllvm/lib/Transforms/Utils/LoopSimplify.cpp
The file was modifiedllvm/lib/Transforms/IPO/Attributor.cpp
The file was modifiedllvm/lib/Transforms/Scalar/SCCP.cpp
The file was modifiedllvm/test/CodeGen/Thumb2/ifcvt-rescan-diamonds.ll
The file was modifiedllvm/lib/Transforms/Utils/LoopUtils.cpp
The file was modifiedllvm/lib/Transforms/Utils/LoopUnroll.cpp
The file was modifiedllvm/test/Transforms/SimplifyCFG/trap-debugloc.ll
Commit f0d41b58da4a102452af47c7b420577bd3d47a03 by wlei
[CSSPGO] Tweak ICP threshold in top-down inliner

This change slightly relaxed the current ICP threshold in top-down inliner, specifically always allow one ICP for it. It shows some perf improvements on SPEC and our internal benchmarks. Also renamed the previous flag. We can also try to turn off PGO ICP in the future.

Reviewed By: wenlei, hoy, wmi

Differential Revision: https://reviews.llvm.org/D106588
The file was modifiedllvm/test/Transforms/SampleProfile/csspgo-inline-icall.ll
The file was modifiedllvm/lib/Transforms/IPO/SampleProfile.cpp
Commit dbefcde6da1b58eb181dcbd8d7913175b2ec8350 by tstellar
Merge all the llvm-exegesis unit tests into a single binary

These tests access private symbols in the backends, so they cannot link
against libLLVM.so and must be statically linked.  Linking these tests
can be slow and with debug builds the resulting binaries use a lot of
disk space.

By merging them into a single test binary means we now only need to
statically link 1 test instead of 6, which helps reduce the build
times and saves disk space.

Reviewed By: courbet

Differential Revision: https://reviews.llvm.org/D106464
The file was modifiedllvm/unittests/tools/llvm-exegesis/PowerPC/SnippetGeneratorTest.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/ARM/CMakeLists.txt
The file was modifiedllvm/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/CMakeLists.txt
The file was modifiedllvm/unittests/tools/llvm-exegesis/X86/CMakeLists.txt
The file was modifiedllvm/tools/llvm-exegesis/lib/BenchmarkResult.h
The file was modifiedllvm/unittests/tools/llvm-exegesis/X86/SchedClassResolutionTest.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/X86/TargetTest.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/AArch64/CMakeLists.txt
The file was modifiedllvm/unittests/tools/llvm-exegesis/Mips/BenchmarkResultTest.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/Mips/SnippetGeneratorTest.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp
The file was modifiedllvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/PowerPC/AnalysisTest.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/PowerPC/CMakeLists.txt
The file was modifiedllvm/unittests/tools/llvm-exegesis/Mips/RegisterAliasingTest.cpp
The file was modifiedllvm/unittests/tools/llvm-exegesis/Mips/CMakeLists.txt
Commit 0237dbfdd38053cc190f814b6f92e311ae3509c6 by yedeng.yd
[Coroutine] Record the elided coroutines

Reviewed By: lxfind

Differential Revision: https://reviews.llvm.org/D105606
The file was addedllvm/test/Transforms/Coroutines/coro-elide-stat.ll
The file was modifiedllvm/lib/Transforms/Coroutines/CoroElide.cpp
The file was removedllvm/test/Transforms/Coroutines/coro-elide-count.ll
Commit cdb4cfe8b3ce2b0c50d4855ec260eab07fe63611 by johannes
[Attributor][FIX] Update AMDGPU attributor test

The test contains UB and should be improved, for now we update the check
lines pass it.
The file was modifiedllvm/test/CodeGen/AMDGPU/annotate-kernel-features-hsa-call.ll
Commit 2aaf038efd8cb5db4e35f8b26a0b28b6ac1bb8b1 by johannes
[Attributor] Update check lines for all AMDGPU attributor tests

I thought there was only one when I pushed
cdb4cfe8b3ce2b0c50d4855ec260eab07fe63611, these should be all (in the
CodeGen/AMDGPU folder).
The file was modifiedllvm/test/CodeGen/AMDGPU/annotate-kernel-features-hsa.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/direct-indirect-call.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/duplicate-attribute-indirect.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/simple-indirect-call.ll
Commit 67ab875ff578588574a63d29d52f73fd25128c74 by johannes
[OpenMP] Prototype opt-in new GPU device RTL

The "old" OpenMP GPU device runtime (D14254) has served us well for many
years but modernizing it has caused some pain recently. This patch
introduces an alternative which is mostly written from scratch embracing
OpenMP 5.X, C++, LLVM coding style (where applicable), and conceptual
interfaces. This new runtime is opt-in through a clang flag (D106793).
The new runtime is currently only build for nvptx and has "-new" in its
name.

The design is tailored towards middle-end optimizations rather than
front-end code generation choices, a trend we already started in the old
runtime a while back. In contrast to the old one, state is organized in
a simple manner rather than a "smart" one. While this can induce costs
it helps optimizations. Our expectation is that the majority of codes
can be optimized and a "simple" design is therefore preferable. The new
runtime does also avoid users to pay for things they do not use,
especially wrt. memory. The unlikely case of nested parallelism is
supported but costly to make the more likely case use less resources.

The worksharing and reduction implementation have been taken from the
old runtime and will be rewritten in the future if necessary.

Documentation and debug features are still mostly missing and will be
added over time.

All external symbols start with `__kmpc` for legacy reasons but should
be renamed once we switch over to a single runtime. All internal symbols
are placed in appropriate namespaces (anonymous or `_OMP`) to avoid name
clashes with user symbols.

Differential Revision: https://reviews.llvm.org/D106803
The file was addedopenmp/libomptarget/DeviceRTL/src/Synchronization.cpp
The file was addedopenmp/libomptarget/DeviceRTL/include/Debug.h
The file was addedopenmp/libomptarget/DeviceRTL/include/Synchronization.h
The file was addedopenmp/libomptarget/DeviceRTL/src/State.cpp
The file was addedopenmp/libomptarget/DeviceRTL/include/State.h
The file was addedopenmp/libomptarget/DeviceRTL/include/Mapping.h
The file was addedopenmp/libomptarget/DeviceRTL/src/Utils.cpp
The file was addedopenmp/libomptarget/DeviceRTL/include/Utils.h
The file was addedopenmp/libomptarget/DeviceRTL/include/Interface.h
The file was addedopenmp/libomptarget/DeviceRTL/src/Kernel.cpp
The file was addedopenmp/libomptarget/DeviceRTL/src/Debug.cpp
The file was addedopenmp/libomptarget/DeviceRTL/src/Configuration.cpp
The file was addedopenmp/libomptarget/DeviceRTL/src/Mapping.cpp
The file was addedopenmp/libomptarget/DeviceRTL/src/Misc.cpp
The file was addedopenmp/libomptarget/DeviceRTL/src/Tasking.cpp
The file was addedopenmp/libomptarget/DeviceRTL/src/Workshare.cpp
The file was addedopenmp/libomptarget/DeviceRTL/include/Types.h
The file was addedopenmp/libomptarget/DeviceRTL/include/Configuration.h
The file was addedopenmp/libomptarget/DeviceRTL/src/Parallelism.cpp
The file was modifiedopenmp/libomptarget/CMakeLists.txt
The file was addedopenmp/libomptarget/DeviceRTL/include/generated_microtask_cases.gen
The file was addedopenmp/libomptarget/DeviceRTL/CMakeLists.txt
The file was addedopenmp/libomptarget/DeviceRTL/src/Reduction.cpp
Commit 75636868e2c96cb17fdfd1ed70e284ab19a15160 by johannes
[InstSimplify] Expose generic interface for replaced operand simplification

Users, especially the Attributor, might replace multiple operands at
once. The actual implementation of simplifyWithOpReplaced is able to
handle that just fine, the interface was simply not allowing to replace
more than one operand at a time. This is exposing a more generic
interface without intended changes for existing code.

Differential Revision: https://reviews.llvm.org/D106189
The file was modifiedllvm/lib/Analysis/InstructionSimplify.cpp
The file was modifiedllvm/include/llvm/Analysis/InstructionSimplify.h
Commit d4bfce552110086f198ba46f37acf63df8758921 by johannes
[Attributor] Utilize the InstSimplify interface to simplify instructions

When we simplify at least one operand in the Attributor simplification
we can use the InstSimplify to work on the simplified operands. This
allows us to avoid duplication of the logic.

Depends on D106189

Differential Revision: https://reviews.llvm.org/D106190
The file was modifiedllvm/test/Transforms/Attributor/willreturn.ll
The file was modifiedllvm/test/Transforms/Attributor/value-simplify-instances.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/aggregate-promote.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/alignment.ll
The file was modifiedllvm/test/Transforms/Attributor/range.ll
The file was modifiedllvm/test/Transforms/Attributor/value-simplify.ll
The file was modifiedllvm/test/Transforms/Attributor/IPConstantProp/dangling-block-address.ll
The file was modifiedllvm/test/Transforms/Attributor/nonnull.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/chained.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/invalidation.ll
The file was modifiedllvm/test/Transforms/Attributor/value-simplify-pointer-info.ll
The file was modifiedllvm/test/Transforms/Attributor/depgraph.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll
The file was modifiedllvm/test/Transforms/Attributor/internalize.ll
The file was modifiedllvm/test/Transforms/Attributor/liveness.ll
The file was modifiedllvm/test/Transforms/Attributor/IPConstantProp/return-argument.ll
The file was modifiedllvm/test/Transforms/Attributor/dereferenceable-1.ll
The file was modifiedllvm/test/Transforms/Attributor/internal-noalias.ll
The file was modifiedllvm/test/Transforms/Attributor/IPConstantProp/PR26044.ll
The file was modifiedllvm/test/Transforms/Attributor/potential.ll
The file was modifiedllvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll
The file was modifiedllvm/test/Transforms/Attributor/lvi-after-jumpthreading.ll
The file was modifiedllvm/lib/Transforms/IPO/AttributorAttributes.cpp