[llvm] e5a7309 - [InstCombine] add test for miscompile from sinkNotIntoLogicalOp(); NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 29 11:35:25 PST 2022


Author: Sanjay Patel
Date: 2022-12-29T14:33:41-05:00
New Revision: e5a7309800f64972339f00301fb5ddb90cd2455a

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

LOG: [InstCombine] add test for miscompile from sinkNotIntoLogicalOp(); NFC

issue #59704

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/sink-not-into-logical-and.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/sink-not-into-logical-and.ll b/llvm/test/Transforms/InstCombine/sink-not-into-logical-and.ll
index f07840c8bbdc9..7917e7ce3b462 100644
--- a/llvm/test/Transforms/InstCombine/sink-not-into-logical-and.ll
+++ b/llvm/test/Transforms/InstCombine/sink-not-into-logical-and.ll
@@ -203,3 +203,28 @@ define i1 @t11(i32 %v0, i32 %v1, i32 %v2, i32 %v3, i1 %v4, i1 %v5) {
   call void @use1(i1 %i5)
   ret i1 %i4
 }
+
+; FIXME: This is a miscompile.
+
+define i1 @PR59704(i1 %c, i1 %b, i64 %arg) {
+; CHECK-LABEL: @PR59704(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    br i1 [[C:%.*]], label [[IF:%.*]], label [[JOIN:%.*]]
+; CHECK:       if:
+; CHECK-NEXT:    br label [[JOIN]]
+; CHECK:       join:
+; CHECK-NEXT:    ret i1 true
+;
+entry:
+  br i1 %c, label %if, label %join
+
+if:
+  %cmp = icmp ne i64 %arg, 0
+  %and = select i1 %cmp, i1 %cmp, i1 false
+  br label %join
+
+join:
+  %phi = phi i1 [ false, %entry ], [ %and, %if ]
+  %not = xor i1 %phi, true
+  ret i1 %not
+}


        


More information about the llvm-commits mailing list