SuccessChanges

Summary

  1. [cmake] Centralize LLVM_ENABLE_WARNINGS option (details)
  2. [SLP] Use for-range loops across ValueLists. NFCI. (details)
  3. [NFC][SCEV] Add tests for @llvm.abs intrinsic (details)
  4. [SCEV] Recognize @llvm.abs as smax(x, -x) (details)
  5. [NFC][SCEV] Add tests for @llvm.*.sat intrinsics (details)
  6. [SCEV] Recognize @llvm.usub.sat as `%x - (umin %x, %y)` (details)
  7. [SCEV] Recognize @llvm.uadd.sat as `%y + umin(%x, (-1 - %y))` (details)
  8. [OpenMP] Protect unrecogonized CUDA error code (details)
  9. [IRBuilder][VectorCombine] make and use a convenience function for unary shuffle; NFC (details)
  10. [SLP] use unary shuffle creator to reduce code duplication; NFC (details)
  11. [AIX][Clang][Driver] Add handling of shared option (details)
  12. [ObjCARC] Initialize return value (details)
Commit b36bdfe5ca0c2b863248f327b03d41516b38dc11 by davelee.com
[cmake] Centralize LLVM_ENABLE_WARNINGS option

Configure default value of `LLVM_ENABLE_WARNINGS` in `HandleLLVMOptions.cmake`.

`LLVM_ENABLE_WARNINGS` is documented as ON by default, but `HandleLLVMOptions` assumes the default has been set somewhere else. If it has not been explicitly set, then `HandleLLVMOptions` implicitly uses OFF as a default.

This removes the various `option()` declarations in favor of a single declaration in `HandleLLVMOptions`. This will prevent the unwanted use of `-w` that is mentioned in a couple of the comments.

Reviewed By: DavidTruby, #libunwind, JDevlieghere, compnerd

Differential Revision: https://reviews.llvm.org/D87243
The file was modifiedflang/CMakeLists.txt
The file was modifiedlibunwind/CMakeLists.txt
The file was modifiedllvm/CMakeLists.txt
The file was modifiedllvm/cmake/modules/HandleLLVMOptions.cmake
The file was modifiedclang/CMakeLists.txt
The file was modifiedllvm/cmake/modules/LLVMConfig.cmake.in
The file was modifiedllvm/runtimes/CMakeLists.txt
Commit 005f826a0546eb11890b7bd36fea6b8b1c5e3fc4 by llvm-dev
[SLP] Use for-range loops across ValueLists. NFCI.

Also rename some existing loops that used a 'j' iterator to consistently use 'V'.
The file was modifiedllvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Commit 83c2d10d3cae57f71e23193d62989725b9b9f2f2 by lebedev.ri
[NFC][SCEV] Add tests for @llvm.abs intrinsic
The file was addedllvm/test/Analysis/ScalarEvolution/abs-intrinsic.ll
Commit 1bb7ab8c4a324aa380bddfc75069e24c19e2bdd0 by lebedev.ri
[SCEV] Recognize @llvm.abs as smax(x, -x)

As per alive2 (ignoring undef):

----------------------------------------
define i32 @src(i32 %x, i1 %y) {
%0:
  %r = abs i32 %x, 0
  ret i32 %r
}
=>
define i32 @tgt(i32 %x, i1 %y) {
%0:
  %neg_x = mul i32 %x, 4294967295
  %r = smax i32 %x, %neg_x
  ret i32 %r
}
Transformation seems to be correct!

----------------------------------------
define i32 @src(i32 %x, i1 %y) {
%0:
  %r = abs i32 %x, 1
  ret i32 %r
}
=>
define i32 @tgt(i32 %x, i1 %y) {
%0:
  %neg_x = mul nsw i32 %x, 4294967295
  %r = smax i32 %x, %neg_x
  ret i32 %r
}
Transformation seems to be correct!
The file was modifiedllvm/lib/Analysis/ScalarEvolution.cpp
The file was modifiedllvm/test/Analysis/ScalarEvolution/abs-intrinsic.ll
Commit 0592de550f5c9ca9de44ed2c5c549f6a3b1c32b7 by lebedev.ri
[NFC][SCEV] Add tests for @llvm.*.sat intrinsics
The file was addedllvm/test/Analysis/ScalarEvolution/saturating-intrinsics.ll
Commit fedc9549d50d80f74169ecce4d0d0648a62249f0 by lebedev.ri
[SCEV] Recognize @llvm.usub.sat as `%x - (umin %x, %y)`

----------------------------------------
define i32 @src(i32 %x, i32 %y) {
%0:
  %r = usub_sat i32 %x, %y
  ret i32 %r
}
=>
define i32 @tgt(i32 %x, i32 %y) {
%0:
  %t0 = umin i32 %x, %y
  %r = sub nuw i32 %x, %t0
  ret i32 %r
}
Transformation seems to be correct!
The file was modifiedllvm/test/Analysis/ScalarEvolution/saturating-intrinsics.ll
The file was modifiedllvm/lib/Analysis/ScalarEvolution.cpp
Commit 64e2cb7e9605995d2efb625203cbd96db1404812 by lebedev.ri
[SCEV] Recognize @llvm.uadd.sat as `%y + umin(%x, (-1 - %y))`

----------------------------------------
define i32 @src(i32 %x, i32 %y) {
%0:
  %r = uadd_sat i32 %x, %y
  ret i32 %r
}
=>
define i32 @tgt(i32 %x, i32 %y) {
%0:
  %t0 = sub nsw nuw i32 4294967295, %y
  %t1 = umin i32 %x, %t0
  %r = add nuw i32 %t1, %y
  ret i32 %r
}
Transformation seems to be correct!

The alternative, naive, lowering could be the following,
although i don't think it's better,
thought it will likely be needed for sadd/ssub/*shl:

----------------------------------------
define i32 @src(i32 %x, i32 %y) {
%0:
  %r = uadd_sat i32 %x, %y
  ret i32 %r
}
=>
define i32 @tgt(i32 %x, i32 %y) {
%0:
  %t0 = zext i32 %x to i33
  %t1 = zext i32 %y to i33
  %t2 = add nuw i33 %t0, %t1
  %t3 = zext i32 4294967295 to i33
  %t4 = umin i33 %t2, %t3
  %r = trunc i33 %t4 to i32
  ret i32 %r
}
Transformation seems to be correct!
The file was modifiedllvm/lib/Analysis/ScalarEvolution.cpp
The file was modifiedllvm/test/Analysis/ScalarEvolution/saturating-intrinsics.ll
Commit 03111e5e7a8690300966a39f0aa2e4f2b4ec919a by tianshilei1992
[OpenMP] Protect unrecogonized CUDA error code

If an error code can not be recognized by cuGetErrorString, errStr remains null and causes crashing at DP() printing.
Protect this case.

Reviewed By: jhuber6, tianshilei1992

Differential Revision: https://reviews.llvm.org/D87980
The file was modifiedopenmp/libomptarget/plugins/cuda/src/rtl.cpp
Commit 1e6b240d7d336a36856268db5349468560e28a0e by spatel
[IRBuilder][VectorCombine] make and use a convenience function for unary shuffle; NFC

This reduces code duplication for common construct.
Follow-ups can use this in SLP, LoopVectorizer, and other passes.
The file was modifiedllvm/lib/Transforms/Vectorize/VectorCombine.cpp
The file was modifiedllvm/include/llvm/IR/IRBuilder.h
Commit a44238cb443f13c1e9fd42f6269f019d505ff5dd by spatel
[SLP] use unary shuffle creator to reduce code duplication; NFC
The file was modifiedllvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Commit d8540427419ec0c4b9bc02f432ef39c01898e826 by daltenty
[AIX][Clang][Driver] Add handling of shared option

Reviewed By: jasonliu

Differential Revision: https://reviews.llvm.org/D87914
The file was modifiedclang/lib/Driver/ToolChains/AIX.cpp
The file was modifiedclang/test/Driver/aix-ld.c
Commit 746a2c3775658c4485a8e71a7d46ee55c30615b8 by aeubanks
[ObjCARC] Initialize return value

Mistakenly removed initialization of `Changed` in https://reviews.llvm.org/D87806.
The file was modifiedllvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp