[llvm] [InstCombine] Tighten use constraint in factorization transforms (PR #102943)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 23 00:48:47 PDT 2024
dtcxzyw wrote:
Regression:
```
; bin/opt -passes=instcombine test.ll -S
define i64 @test(i64 %23, i64 %24) {
entry:
%.idx14.i = shl nsw i64 %23, 3
%.idx.i = shl nsw i64 %24, 3
%gepdiff.i = sub nsw i64 %.idx.i, %.idx14.i
%25 = ashr exact i64 %gepdiff.i, 3
call void @use(i64 %.idx14.i)
ret i64 %25
}
declare void @use(i64)
```
It can be folded into:
```
define i64 @test(i64 %0, i64 %1) {
entry:
%.idx14.i = shl nsw i64 %0, 3
%2 = sub nsw i64 %1, %0
call void @use(i64 %.idx14.i)
ret i64 %2
}
```
https://github.com/llvm/llvm-project/pull/102943
More information about the llvm-commits
mailing list