diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll index 554619caa61510..95c006e76ccb8c 100644 --- a/llvm/test/Transforms/InstCombine/icmp.ll +++ b/llvm/test/Transforms/InstCombine/icmp.ll @@ -3930,3 +3930,23 @@ bb: %i3 = icmp eq i32 %i, %i2 ret i1 %i3 } + +; PR50944 + +define i1 @thread_cmp_over_select_with_poison_trueval(i1 %b) { +; CHECK-LABEL: @thread_cmp_over_select_with_poison_trueval( +; CHECK-NEXT: ret i1 poison +; + %s = select i1 %b, i32 poison, i32 0 + %tobool = icmp ne i32 %s, 0 + ret i1 %tobool +} + +define i1 @thread_cmp_over_select_with_poison_falseval(i1 %b) { +; CHECK-LABEL: @thread_cmp_over_select_with_poison_falseval( +; CHECK-NEXT: ret i1 poison +; + %s = select i1 %b, i32 1, i32 poison + %tobool = icmp ne i32 %s, 0 + ret i1 %tobool +}