Skip to content

Commit d720e58

Browse files
nikiczmodem
authored andcommitted
Add test for PR47322 (NFC)
1 parent 2d61b5e commit d720e58

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

llvm/test/Transforms/InstCombine/select.ll

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,3 +2487,19 @@ define <2 x i32> @true_undef_vec(i1 %cond, <2 x i32> %x) {
24872487
%s = select i1 %cond, <2 x i32> undef, <2 x i32> %x
24882488
ret <2 x i32> %s
24892489
}
2490+
2491+
; FIXME: This is a miscompile!
2492+
define i32 @pr47322_more_poisonous_replacement(i32 %arg) {
2493+
; CHECK-LABEL: @pr47322_more_poisonous_replacement(
2494+
; CHECK-NEXT: [[TRAILING:%.*]] = call i32 @llvm.cttz.i32(i32 [[ARG:%.*]], i1 immarg true), [[RNG0:!range !.*]]
2495+
; CHECK-NEXT: [[SHIFTED:%.*]] = lshr i32 [[ARG]], [[TRAILING]]
2496+
; CHECK-NEXT: ret i32 [[SHIFTED]]
2497+
;
2498+
%cmp = icmp eq i32 %arg, 0
2499+
%trailing = call i32 @llvm.cttz.i32(i32 %arg, i1 immarg true)
2500+
%shifted = lshr i32 %arg, %trailing
2501+
%r1.sroa.0.1 = select i1 %cmp, i32 0, i32 %shifted
2502+
ret i32 %r1.sroa.0.1
2503+
}
2504+
2505+
declare i32 @llvm.cttz.i32(i32, i1 immarg)

0 commit comments

Comments
 (0)