SuccessChanges

Summary

  1. [OPENMP]Fix codegen for is_device_ptr component, captured by reference. (details)
  2. [OpenMP] Additional Information for Libomptarget Mappings (details)
  3. [TSAN] Handle musttail call properly in EscapeEnumerator (and TSAN) (details)
  4. [AMDGPU] Unify intrinsic ret/nortn interface (details)
  5. GlobalISel: Add combines for G_TRUNC (details)
  6. [SourceManager] Explicitly check for potential iterator underflow (details)
  7. [ThinLTO] add post-thinlto-merge option to -lto-embed-bitcode (details)
  8. [GISel] Add new GISel combiners for G_MUL (details)
  9. [BFI] Make BFI information available through loop passes inside LoopStandardAnalysisResults (details)
  10. [llvm][cmake] Change LLVM_INTEGRATED_CRT_ALLOC to a path instead of a boolean (details)
Commit 9e3842d60351f986d77dfe0a94f76e4fd895f188 by a.bataev
[OPENMP]Fix codegen for is_device_ptr component, captured by reference.

Need to map the component as TO instead of the literal, because need to
pass a reference to a component if the pointer is overaligned.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D84887
The file was modifiedclang/test/OpenMP/target_is_device_ptr_codegen.cpp
The file was modifiedclang/lib/CodeGen/CGOpenMPRuntime.cpp
Commit c3e6054b07be1340fb255abe1e3c85b911710059 by huberjn
[OpenMP] Additional Information for Libomptarget Mappings

Summary:
This patch adds additonal support for priting infromation from Libomptarget for
already existing maps and printing the final data mapped on the device at
device destruction.

Reviewers: jdoerfort gkistanova

Subscribers: guansong openmp-commits sstefan1 yaxunl

Tags: #OpenMP

Differential Revision: https://reviews.llvm.org/D87722
The file was modifiedopenmp/libomptarget/src/device.cpp
The file was modifiedopenmp/libomptarget/src/interface.cpp
The file was modifiedopenmp/libomptarget/src/private.h
Commit 7b4cc0961b142877794645576d2393af43c48069 by xun
[TSAN] Handle musttail call properly in EscapeEnumerator (and TSAN)

Call instructions with musttail tag must be optimized as a tailcall, otherwise could lead to incorrect program behavior.
When TSAN is instrumenting functions, it broke the contract by adding a call to the tsan exit function inbetween the musttail call and return instruction, and also inserted exception handling code.
This happend throguh EscapeEnumerator, which adds exception handling code and returns ret instructions as the place to insert instrumentation calls.
This becomes especially problematic for coroutines, because coroutines rely on tail calls to do symmetric transfers properly.
To fix this, this patch moves the location to insert instrumentation calls prior to the musttail call for ret instructions that are following musttail calls, and also does not handle exception for musttail calls.

Differential Revision: https://reviews.llvm.org/D87620
The file was modifiedllvm/lib/Transforms/Utils/EscapeEnumerator.cpp
The file was addedllvm/test/Instrumentation/ThreadSanitizer/tsan_musttail.ll
Commit 277de43d88c9d0d57235e3df617d462487e17e20 by Stanislav.Mekhanoshin
[AMDGPU] Unify intrinsic ret/nortn interface

We have a single noret intrinsic an a lot of special handling
around it. Declare it just as any other but do not define rtn
instructions itself instead.

Differential Revision: https://reviews.llvm.org/D87719
The file was modifiedllvm/lib/Target/AMDGPU/FLATInstructions.td
The file was modifiedllvm/lib/Target/AMDGPU/BUFInstructions.td
The file was addedllvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.global.atomic.fadd-with-ret.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.buffer.atomic.fadd.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/llvm.amdgcn.atomic.fadd.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/shl_add_ptr_global.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.global.atomic.fadd.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-amdgcn.s.buffer.load.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/cgp-addressing-modes-gfx1030.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/cgp-addressing-modes-gfx908.ll
The file was modifiedllvm/lib/Target/AMDGPU/SIInstructions.td
The file was modifiedllvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.atomic.fadd.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/global-atomics-fp.ll
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
The file was addedllvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.buffer.atomic.fadd-with-ret.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/global-saddr-atomics.gfx908.ll
The file was modifiedllvm/include/llvm/IR/IntrinsicsAMDGPU.td
The file was modifiedllvm/test/CodeGen/AMDGPU/fail-select-buffer-atomic-fadd.ll
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
The file was modifiedllvm/lib/Target/AMDGPU/SIISelLowering.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/buffer-intrinsics-mmo-offsets.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/llvm.amdgcn.raw.buffer.atomic.fadd.ll
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.buffer.atomic.fadd.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-amdgcn-s-buffer-load.mir
The file was modifiedllvm/lib/Target/AMDGPU/SIInstrInfo.td
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUInstructions.td
Commit a4e35cc2ec1036832e7626191f8b9f0e3169477c by vkeles
GlobalISel: Add combines for G_TRUNC

https://reviews.llvm.org/D87050
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/xnor.ll
The file was modifiedllvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
The file was modifiedllvm/include/llvm/Target/GlobalISel/Combine.td
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/shl.ll
The file was modifiedllvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/combine-trunc.mir
The file was modifiedllvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
Commit ae726fecae9a1cc9c50de5a9f6e860056f82c556 by Jan Korous
[SourceManager] Explicitly check for potential iterator underflow

Differential Revision: https://reviews.llvm.org/D86231
The file was modifiedclang/lib/Basic/SourceManager.cpp
Commit 61fc10d6a520f267e11009ce8fce88d73615796b by mtrofin
[ThinLTO] add post-thinlto-merge option to -lto-embed-bitcode

This will embed bitcode after (Thin)LTO merge, but before optimizations.
In the case the thinlto backend is called from clang, the .llvmcmd
section is also produced. Doing so in the case where the caller is the
linker doesn't yet have a motivation, and would require plumbing through
command line args.

Differential Revision: https://reviews.llvm.org/D87636
The file was addedclang/test/CodeGen/Inputs/start-lib2.ll
The file was modifiedllvm/include/llvm/LTO/LTOBackend.h
The file was modifiedclang/lib/CodeGen/BackendUtil.cpp
The file was modifiedllvm/test/LTO/X86/Inputs/start-lib1.ll
The file was addedclang/test/CodeGen/Inputs/start-lib1.ll
The file was modifiedllvm/test/LTO/X86/embed-bitcode.ll
The file was addedclang/test/CodeGen/thinlto_embed_bitcode.ll
The file was modifiedllvm/lib/LTO/LTOBackend.cpp
Commit 97203cfd6bae0388f9dd22ddca592737324a2c72 by aditya_nandakumar
[GISel] Add new GISel combiners for G_MUL

https://reviews.llvm.org/D87668

Patch adds two new GICombinerRules, one for G_MUL(X, 1) and another for G_MUL(X, -1).
G_MUL(X, 1) is an identity combine, and G_MUL(X, -1) gets replaced with G_SUB(0, X).
Patch additionally adds new combiner tests for the AArch64 target to test these
new combiner rules, as well as updates AMDGPU GISel tests.

Patch by mkitzan
The file was modifiedllvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/combine-mul.mir
The file was modifiedllvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
The file was modifiedllvm/include/llvm/Target/GlobalISel/Combine.td
Commit 2ea4c2c598b7c6f95b5d4db747bdf72770e586df by aktoon
[BFI] Make BFI information available through loop passes inside LoopStandardAnalysisResults

~~D65060 uncovered that trying to use BFI in loop passes can lead to non-deterministic behavior when blocks are re-used while retaining old BFI data.~~

~~To make sure BFI is preserved through loop passes a Value Handle (VH) callback is registered on blocks themselves. When a block is freed it now also wipes out the accompanying BFI entry such that stale BFI data can no longer persist resolving the determinism issue. ~~

~~An optimistic approach would be to incrementally update BFI information throughout the loop passes rather than only invalidating them on removed blocks. The issues with that are:~~
~~1. It is not clear how BFI information should be incrementally updated: If a block is duplicated does its BFI information come with? How about if it's split/modified/moved around? ~~
~~2. Assuming we can address these problems the implementation here will be a massive undertaking. ~~

~~There's a known need of BFI in LICM analysis which requires correct but not incrementally updated BFI data. A follow-up change can register BFI in all loop passes so this preserved but potentially lossy data is available to any loop pass that wants it.~~

See: D75341 for an identical implementation of preserving BFI via VH callbacks. The previous statements do still apply but this change no longer has to be in this diff because it's already upstream 😄 .

This diff also moves BFI to be a part of LoopStandardAnalysisResults since the previous method using getCachedResults now (correctly!) statically asserts (D72893) that this data isn't static through the loop passes.

Testing
Ninja check

Reviewed By: asbirlea, nikic

Differential Revision: https://reviews.llvm.org/D86156
The file was modifiedllvm/include/llvm/Analysis/LoopAnalysisManager.h
The file was modifiedllvm/lib/Transforms/Scalar/LoopDistribute.cpp
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
The file was modifiedllvm/lib/Transforms/Scalar/LICM.cpp
The file was modifiedllvm/include/llvm/Transforms/Scalar/LoopPassManager.h
The file was modifiedllvm/lib/Transforms/Scalar/LoopUnswitch.cpp
The file was modifiedllvm/lib/Transforms/Utils/LoopVersioning.cpp
The file was modifiedllvm/test/Other/opt-O3-pipeline-enable-matrix.ll
The file was modifiedllvm/lib/Passes/PassBuilder.cpp
The file was modifiedllvm/test/Other/opt-O3-pipeline.ll
The file was modifiedllvm/test/Other/opt-O2-pipeline.ll
The file was modifiedllvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
The file was modifiedllvm/test/Other/opt-Os-pipeline.ll
The file was modifiedllvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp
Commit 50ee05ab65db2ab262436ee0f92f7888607a89f3 by alexandre.ganea
[llvm][cmake] Change LLVM_INTEGRATED_CRT_ALLOC to a path instead of a boolean

Differential Revision: https://reviews.llvm.org/D87609
The file was modifiedllvm/CMakeLists.txt