Skip to content

Commit 2a18217

Browse files
committed
[InstSimplify] Add additional test for #70335 (NFC)
Test the interaction with llvm.is.constant.
1 parent fee2953 commit 2a18217

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,3 +323,18 @@ define i1 @and_icmp_implies_poison(i32 %x) {
323323
%and = and i1 %cmp1, %cmp2
324324
ret i1 %and
325325
}
326+
327+
define i1 @and_is_constant(ptr %arg, ptr %arg2) {
328+
; CHECK-LABEL: @and_is_constant(
329+
; CHECK-NEXT: [[ICMP:%.*]] = icmp eq ptr [[ARG:%.*]], [[ARG2:%.*]]
330+
; CHECK-NEXT: [[CALL:%.*]] = call i1 @llvm.is.constant.i1(i1 [[ICMP]])
331+
; CHECK-NEXT: [[AND:%.*]] = and i1 [[CALL]], [[ICMP]]
332+
; CHECK-NEXT: ret i1 [[AND]]
333+
;
334+
%icmp = icmp eq ptr %arg, %arg2
335+
%call = call i1 @llvm.is.constant.i1(i1 %icmp)
336+
%and = and i1 %call, %icmp
337+
ret i1 %and
338+
}
339+
340+
declare i1 @llvm.is.constant.i1(i1)

0 commit comments

Comments
 (0)