[llvm] 93d7d9b - [InstSimplify] Add test for #98753 (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 05:38:04 PDT 2024


Author: Nikita Popov
Date: 2024-07-15T14:37:53+02:00
New Revision: 93d7d9bfd4aede19dda0ebaf8aead12c2adbd13b

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

LOG: [InstSimplify] Add test for #98753 (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/InstSimplify/and-or-implied-cond.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstSimplify/and-or-implied-cond.ll b/llvm/test/Transforms/InstSimplify/and-or-implied-cond.ll
index 16a5f8fbf1310..8620dce059ae7 100644
--- a/llvm/test/Transforms/InstSimplify/and-or-implied-cond.ll
+++ b/llvm/test/Transforms/InstSimplify/and-or-implied-cond.ll
@@ -331,4 +331,19 @@ define i1 @and_is_constant(ptr %arg, ptr %arg2) {
   ret i1 %and
 }
 
+; FIXME: This is a miscompile.
+define i1 @pr98753(i32 noundef %x, i32 %y) {
+; CHECK-LABEL: @pr98753(
+; CHECK-NEXT:    [[CMP1:%.*]] = icmp ne i32 [[X:%.*]], 0
+; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP1]], i32 [[Y:%.*]], i32 undef
+; CHECK-NEXT:    [[CMP2:%.*]] = icmp sgt i32 [[SEL]], 0
+; CHECK-NEXT:    ret i1 [[CMP2]]
+;
+  %cmp1 = icmp ne i32 %x, 0
+  %sel = select i1 %cmp1, i32 %y, i32 undef
+  %cmp2 = icmp sgt i32 %sel, 0
+  %and = and i1 %cmp1, %cmp2
+  ret i1 %and
+}
+
 declare i1 @llvm.is.constant.i1(i1)


        


More information about the llvm-commits mailing list