[llvm] Missing opt with ctlz and shifts of power of 2 constants (#41333) (PR #74175)
Sizov Nikita via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 2 12:17:24 PST 2023
================
@@ -514,6 +514,8 @@ static Instruction *foldCttzCtlz(IntrinsicInst &II, InstCombinerImpl &IC) {
return IC.replaceInstUsesWith(II, ConstantInt::getNullValue(II.getType()));
}
+ ConstantInt *CInt;
----------------
snikitav wrote:
If change `ConstantInt` to `Constant` not only constant splat vectors may be handled:
```llvm
----------------------------------------
define <2 x i32> @src(<2 x i32> %#0) {
#1:
%div = lshr <2 x i32> { 8387584, 1234567 }, %#0
%ctlz = ctlz <2 x i32> %div, 1
ret <2 x i32> %ctlz
}
=>
define <2 x i32> @tgt(<2 x i32> %#0) {
#1:
%ctlz = add <2 x i32> %#0, { 9, 11 }
ret <2 x i32> %ctlz
}
Transformation seems to be correct!
```
https://github.com/llvm/llvm-project/pull/74175
More information about the llvm-commits
mailing list