[llvm] 2a18217 - [InstSimplify] Add additional test for #70335 (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 08:15:32 PDT 2023


Author: Nikita Popov
Date: 2023-11-02T16:15:23+01:00
New Revision: 2a1821766c7395a97adcb32d01709a421dde7007

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

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

Test the interaction with llvm.is.constant.

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 b916d899a91b6f8..2a327e8b79584e3 100644
--- a/llvm/test/Transforms/InstSimplify/and-or-implied-cond.ll
+++ b/llvm/test/Transforms/InstSimplify/and-or-implied-cond.ll
@@ -323,3 +323,18 @@ define i1 @and_icmp_implies_poison(i32 %x) {
   %and = and i1 %cmp1, %cmp2
   ret i1 %and
 }
+
+define i1 @and_is_constant(ptr %arg, ptr %arg2) {
+; CHECK-LABEL: @and_is_constant(
+; CHECK-NEXT:    [[ICMP:%.*]] = icmp eq ptr [[ARG:%.*]], [[ARG2:%.*]]
+; CHECK-NEXT:    [[CALL:%.*]] = call i1 @llvm.is.constant.i1(i1 [[ICMP]])
+; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CALL]], [[ICMP]]
+; CHECK-NEXT:    ret i1 [[AND]]
+;
+  %icmp = icmp eq ptr %arg, %arg2
+  %call = call i1 @llvm.is.constant.i1(i1 %icmp)
+  %and = and i1 %call, %icmp
+  ret i1 %and
+}
+
+declare i1 @llvm.is.constant.i1(i1)


        


More information about the llvm-commits mailing list