[llvm] [SLP]Model gathers of extracted integer sub-fields as bitcast+permute+ext (PR #224919)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 27 11:20:29 PDT 2026
nikic wrote:
AI flagged a miscompile introduced by this change (https://alive2.llvm.org/ce/z/XkhM6F):
```llvm
define i32 @src(i32 %x) {
%t0 = trunc i32 %x to i8
%s1 = lshr i32 %x, 8
%t1 = trunc i32 %s1 to i8
%s2 = lshr i32 %x, 16
%t2 = trunc i32 %s2 to i8
%s3 = lshr i32 %x, 24
%t3 = trunc i32 %s3 to i8
%f0 = zext i8 %t0 to i32
%f1 = zext i8 %t1 to i32
%f2 = zext i8 %t2 to i32
%f3 = zext i8 %t3 to i32
%a = add i32 %f2, %f0
%b = add i32 %a, %f3
%c = add i32 %b, %f1
%d = add i32 %c, %f3
%e = add i32 %d, %f3
ret i32 %e
}
define i32 @tgt(i32 %x) {
%1 = bitcast i32 %x to <4 x i8>
%2 = zext <4 x i8> %1 to <4 x i16>
%3 = zext <4 x i16> %2 to <4 x i32>
%4 = mul <4 x i32> %3, <i32 3, i32 1, i32 1, i32 1>
%5 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %4)
ret i32 %5
}
```
Mul constant is in the wrong order.
https://github.com/llvm/llvm-project/pull/224919
More information about the llvm-commits
mailing list