[llvm] 09e3bf0 - [InstCombine][test] add tests for icmp simplify miscompile (PR50944); NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 1 14:47:20 PDT 2021


Author: Sanjay Patel
Date: 2021-07-01T17:40:07-04:00
New Revision: 09e3bf01b3da978b5437bf84c0b0f290974d8743

URL: https://github.com/llvm/llvm-project/commit/09e3bf01b3da978b5437bf84c0b0f290974d8743
DIFF: https://github.com/llvm/llvm-project/commit/09e3bf01b3da978b5437bf84c0b0f290974d8743.diff

LOG: [InstCombine][test] add tests for icmp simplify miscompile (PR50944); NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/icmp.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll
index 554619caa6151..95c006e76ccb8 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
+}


        


More information about the llvm-commits mailing list