[llvm] [InstCombine] Handle mul in `maintainNoSignedWrap` (PR #123299)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 00:32:04 PST 2025


dtcxzyw wrote:

After this patch:
```
define ptr @foo3(i16 noundef %x, ptr noundef %p) {
  %cmp = icmp sgt i16 %x, 0
  call void @llvm.assume(i1 %cmp)
  %b.idx = mul nuw nsw i16 %x, 6
  %b = getelementptr inbounds nuw i8, ptr %p, i16 %b.idx
  store i16 2, ptr %b, align 2
  store i16 1, ptr %p, align 2
  ret ptr %b
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
===== Alias Analysis Evaluator Report =====
  1 Total Alias Queries Performed
  1 no alias responses (100.0%)
  0 may alias responses (0.0%)
  0 partial alias responses (0.0%)
  0 must alias responses (0.0%)
  Alias Analysis Evaluator Pointer Alias Summary: 100%/0%/0%/0%
  2 Total ModRef Queries Performed
  2 no mod/ref responses (100.0%)
  0 mod responses (0.0%)
  0 ref responses (0.0%)
  0 mod & ref responses (0.0%)
  Alias Analysis Evaluator Mod/Ref Summary: 100%/0%/0%/0%
===== Alias Analysis Evaluator Report =====
  1 Total Alias Queries Performed
  1 no alias responses (100.0%)
  0 may alias responses (0.0%)
  0 partial alias responses (0.0%)
  0 must alias responses (0.0%)
  Alias Analysis Evaluator Pointer Alias Summary: 100%/0%/0%/0%
  2 Total ModRef Queries Performed
  2 no mod/ref responses (100.0%)
  0 mod responses (0.0%)
  0 ref responses (0.0%)
  0 mod & ref responses (0.0%)
  Alias Analysis Evaluator Mod/Ref Summary: 100%/0%/0%/0%
```

https://github.com/llvm/llvm-project/pull/123299


More information about the llvm-commits mailing list