SuccessChanges

Summary

  1. [BuildLibcalls] Mark some libcalls with inaccessiblememonly and inaccessiblemem_or_argmemonly (details)
  2. Revert "[BuildLibcalls] Mark some libcalls with inaccessiblememonly and inaccessiblemem_or_argmemonly" (details)
  3. [Libcalls, Attrs] Annotate libcalls with noundef (details)
  4. [RISCV] Teach our custom vector load/store intrinsic isel code to propagate memory operands if we have them. (details)
  5. Revert "[Libcalls, Attrs] Annotate libcalls with noundef" (details)
  6. [SampleFDO] Skip PreLink ICP for better profile quality of MonoLTO PostLink (details)
  7. [mlir][sparse] convert function pass to module pass (details)
  8. [ValueTracking] Improve impliesPoison (details)
Commit 05d891a19e45687090edcfccfbad334911659eb0 by Dávid Bolvanský
[BuildLibcalls] Mark some libcalls with inaccessiblememonly and inaccessiblemem_or_argmemonly

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D94850
The file was modifiedllvm/lib/Transforms/Utils/BuildLibCalls.cpp
The file was modifiedllvm/test/Transforms/InferFunctionAttrs/annotate.ll
Commit 68e6025cf7e37f6da66dfe4e6484fcc921237b42 by Dávid Bolvanský
Revert "[BuildLibcalls] Mark some libcalls with inaccessiblememonly and inaccessiblemem_or_argmemonly"

This reverts commit 05d891a19e45687090edcfccfbad334911659eb0.
The file was modifiedllvm/test/Transforms/InferFunctionAttrs/annotate.ll
The file was modifiedllvm/lib/Transforms/Utils/BuildLibCalls.cpp
Commit 33b0c63775ce58014c55e285671e3315104a6076 by Dávid Bolvanský
[Libcalls, Attrs] Annotate libcalls with noundef

I think we can use here same logic as for nonnull.

strlen(X) - X must be noundef => valid pointer.

for libcalls with size arg, we add noundef only if size is known and greater than 0 - so pointers must be noundef (valid ones)

Reviewed By: jdoerfert, aqjune

Differential Revision: https://reviews.llvm.org/D95122
The file was modifiedllvm/test/Transforms/MemCpyOpt/memcpy-to-memset-with-lifetimes.ll
The file was modifiedllvm/test/Transforms/InstCombine/mem-deref-bytes-addrspaces.ll
The file was modifiedllvm/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll
The file was modifiedllvm/test/Transforms/InstCombine/memset_chk-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/strcpy-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/memcpy-to-load.ll
The file was modifiedllvm/test/Transforms/LowerMatrixIntrinsics/multiply-fused-loops.ll
The file was modifiedllvm/test/Transforms/InstCombine/AMDGPU/memcpy-from-constant.ll
The file was modifiedllvm/test/Transforms/InstCombine/puts-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll
The file was modifiedllvm/test/Transforms/InstCombine/strcmp-memcmp.ll
The file was modifiedllvm/test/Transforms/InstCombine/strlen-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/mempcpy.ll
The file was modifiedllvm/test/Transforms/InstCombine/strncpy-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/getelementptr.ll
The file was modifiedllvm/test/Transforms/LoopUnroll/WebAssembly/basic-unrolling.ll
The file was modifiedllvm/test/Transforms/InstCombine/printf-1.ll
The file was modifiedllvm/test/Transforms/LowerMatrixIntrinsics/multiply-fused-multiple-blocks.ll
The file was modifiedllvm/test/Transforms/InstCombine/memmove_chk-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/memset-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/strcspn-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/memccpy.ll
The file was modifiedllvm/test/Transforms/InstCombine/objsize.ll
The file was modifiedllvm/test/Transforms/InstCombine/strlen-2.ll
The file was modifiedllvm/test/Transforms/InstCombine/strstr-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/align-addr.ll
The file was modifiedllvm/test/Transforms/InstCombine/memcpy-from-global.ll
The file was modifiedllvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
The file was modifiedllvm/test/Transforms/InstCombine/stpcpy_chk-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/mem-deref-bytes.ll
The file was modifiedllvm/test/Transforms/LowerMatrixIntrinsics/multiply-fused.ll
The file was modifiedllvm/test/Transforms/InstCombine/memcmp-constant-fold.ll
The file was modifiedllvm/test/Transforms/InstCombine/sprintf-1.ll
The file was modifiedllvm/test/Other/cgscc-libcall-update.ll
The file was modifiedllvm/test/Transforms/InstCombine/memcpy_chk-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/strcpy_chk-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/strcmp-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/stpcpy-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/ARM/strcmp.ll
The file was modifiedllvm/test/Transforms/InstCombine/strncat-2.ll
The file was modifiedllvm/test/Transforms/MemCpyOpt/lifetime.ll
The file was modifiedllvm/test/Transforms/MemCpyOpt/pr29105.ll
The file was modifiedllvm/test/Transforms/InstCombine/strrchr-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/strncmp-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/strpbrk-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/strncpy-3.ll
The file was modifiedllvm/test/Transforms/InstCombine/strchr-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/fortify-folding.ll
The file was modifiedllvm/test/Transforms/InstCombine/malloc-free-delete.ll
The file was modifiedllvm/test/Analysis/BasicAA/gep-alias.ll
The file was modifiedllvm/test/Transforms/InstCombine/snprintf.ll
The file was modifiedllvm/test/Transforms/InstCombine/memcpy.ll
The file was modifiedllvm/test/Transforms/InstCombine/strncpy_chk-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/memchr.ll
Commit 71b68fe532b3aa8dddf55d1945f26ee3ad3e9867 by craig.topper
[RISCV] Teach our custom vector load/store intrinsic isel code to propagate memory operands if we have them.

We don't currently create memory operands for these intrinsics,
but there was a suggestion of using the indexed load/store
intrinsics to implement isel for scalable vector gather/scatter.
That may propagate the memory operand from the gather/scatter
ISD nodes.
The file was modifiedllvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
Commit 94d034fb86584ff2e95dd5c62dec46c8b4c383a9 by Dávid Bolvanský
Revert "[Libcalls, Attrs] Annotate libcalls with noundef"

This reverts commit 33b0c63775ce58014c55e285671e3315104a6076. Bots are failing. Some Clang tests need to be updated too.
The file was modifiedllvm/test/Transforms/InstCombine/strcpy_chk-1.ll
The file was modifiedllvm/test/Transforms/LowerMatrixIntrinsics/multiply-fused-loops.ll
The file was modifiedllvm/test/Transforms/InstCombine/strncpy-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/memcmp-constant-fold.ll
The file was modifiedllvm/test/Transforms/InstCombine/strncmp-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/AMDGPU/memcpy-from-constant.ll
The file was modifiedllvm/test/Transforms/InstCombine/memcpy-to-load.ll
The file was modifiedllvm/test/Transforms/LoopUnroll/WebAssembly/basic-unrolling.ll
The file was modifiedllvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
The file was modifiedllvm/test/Transforms/InstCombine/strcpy-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/memcpy-from-global.ll
The file was modifiedllvm/test/Transforms/InstCombine/mem-deref-bytes-addrspaces.ll
The file was modifiedllvm/test/Transforms/InstCombine/fortify-folding.ll
The file was modifiedllvm/test/Transforms/InstCombine/ARM/strcmp.ll
The file was modifiedllvm/test/Transforms/InstCombine/malloc-free-delete.ll
The file was modifiedllvm/test/Transforms/InstCombine/mem-deref-bytes.ll
The file was modifiedllvm/test/Transforms/InstCombine/memcpy.ll
The file was modifiedllvm/test/Transforms/InstCombine/strcspn-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/memset-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/strncpy_chk-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/memmove_chk-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/strrchr-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/strcmp-memcmp.ll
The file was modifiedllvm/test/Transforms/InstCombine/getelementptr.ll
The file was modifiedllvm/test/Transforms/InstCombine/puts-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/mempcpy.ll
The file was modifiedllvm/test/Transforms/InstCombine/memcpy_chk-1.ll
The file was modifiedllvm/test/Transforms/LowerMatrixIntrinsics/multiply-fused-multiple-blocks.ll
The file was modifiedllvm/test/Transforms/InstCombine/stpcpy-1.ll
The file was modifiedllvm/test/Transforms/MemCpyOpt/memcpy-to-memset-with-lifetimes.ll
The file was modifiedllvm/test/Transforms/InstCombine/strlen-2.ll
The file was modifiedllvm/test/Transforms/InstCombine/strlen-1.ll
The file was modifiedllvm/test/Transforms/LowerMatrixIntrinsics/multiply-fused.ll
The file was modifiedllvm/test/Transforms/InstCombine/strstr-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/sprintf-1.ll
The file was modifiedllvm/test/Analysis/BasicAA/gep-alias.ll
The file was modifiedllvm/test/Transforms/InstCombine/strpbrk-1.ll
The file was modifiedllvm/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll
The file was modifiedllvm/test/Transforms/InstCombine/objsize.ll
The file was modifiedllvm/test/Transforms/MemCpyOpt/lifetime.ll
The file was modifiedllvm/test/Transforms/InstCombine/strcmp-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/memset_chk-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/strncpy-3.ll
The file was modifiedllvm/test/Transforms/MemCpyOpt/pr29105.ll
The file was modifiedllvm/test/Transforms/InstCombine/align-addr.ll
The file was modifiedllvm/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll
The file was modifiedllvm/test/Transforms/InstCombine/printf-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/snprintf.ll
The file was modifiedllvm/test/Other/cgscc-libcall-update.ll
The file was modifiedllvm/test/Transforms/InstCombine/stpcpy_chk-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/strncat-2.ll
The file was modifiedllvm/test/Transforms/InstCombine/strchr-1.ll
The file was modifiedllvm/test/Transforms/InstCombine/memchr.ll
The file was modifiedllvm/test/Transforms/InstCombine/memccpy.ll
Commit a952d7291e99aded397073f61e091c0f011da779 by aktoon
[SampleFDO] Skip PreLink ICP for better profile quality of MonoLTO PostLink

For ThinLTO, PreLink ICP is skipped to favor better profile annotation during LTO PostLink. This change applies the same tweak for MonoLTO. Note that PreLink ICP not only makes PostLink profile annotation harder, it is also uncoordinated with PostLink ICP so duplicated ICP could happen.

Differential Revision: https://reviews.llvm.org/D97028
The file was modifiedllvm/lib/Passes/PassBuilder.cpp
Commit f32b3401e17767ae861943ebb3da814e4a969a4b by ajcbik
[mlir][sparse] convert function pass to module pass

Rationale:
Touching function level information can only be done within a module pass.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D97102
The file was modifiedmlir/test/lib/Transforms/TestSparsification.cpp
Commit aacf7878bc83a5231d2768f8dd69e98b7607366f by aqjune
[ValueTracking] Improve impliesPoison

This patch improves ValueTracking's impliesPoison(V1, V2) to do this reasoning:

```
  %res = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %a, i64 %b)
  %overflow = extractvalue { i64, i1 } %res, 1
  %mul      = extractvalue { i64, i1 } %res, 0

; If %mul is poison, %overflow is also poison, and vice versa.
```

This improvement leads to supporting this optimization under `-instcombine-unsafe-select-transform=0`:

```
define i1 @test2_logical(i64 %a, i64 %b, i64* %ptr) {
; CHECK-LABEL: @test2_logical(
; CHECK-NEXT:    [[MUL:%.*]] = mul i64 [[A:%.*]], [[B:%.*]]
; CHECK-NEXT:    [[TMP1:%.*]] = icmp ne i64 [[A]], 0
; CHECK-NEXT:    [[TMP2:%.*]] = icmp ne i64 [[B]], 0
; CHECK-NEXT:    [[OVERFLOW_1:%.*]] = and i1 [[TMP1]], [[TMP2]]
; CHECK-NEXT:    [[NEG:%.*]] = sub i64 0, [[MUL]]
; CHECK-NEXT:    store i64 [[NEG]], i64* [[PTR:%.*]], align 8
; CHECK-NEXT:    ret i1 [[OVERFLOW_1]]
;

  %res = tail call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %a, i64 %b)
  %overflow = extractvalue { i64, i1 } %res, 1
  %mul = extractvalue { i64, i1 } %res, 0
  %cmp = icmp ne i64 %mul, 0
  %overflow.1 = select i1 %overflow, i1 true, i1 %cmp
  %neg = sub i64 0, %mul
  store i64 %neg, i64* %ptr, align 8
  ret i1 %overflow.1
}
```

Previously, this didn't happen because the flag prevented `select i1 %overflow, i1 true, i1 %cmp` from being `or i1 %overflow, %cmp`.
Note that the select -> or conversion happens only when `impliesPoison(%cmp, %overflow)` returns true.
This improvement allows `impliesPoison` to do the reasoning.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D96929
The file was modifiedllvm/include/llvm/IR/PatternMatch.h
The file was modifiedllvm/lib/Analysis/ValueTracking.cpp
The file was modifiedllvm/include/llvm/Analysis/ValueTracking.h
The file was modifiedllvm/test/Transforms/InstCombine/umul-sign-check.ll