Skip to content

Commit e48a70e

Browse files
committed
[ConstraintElim] Add pre-commit tests. NFC.
1 parent 69cc3f0 commit e48a70e

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt -p constraint-elimination -S %s | FileCheck %s
3+
4+
define void @f(i32 noundef %v0, i32 noundef %v1, i32 noundef %v2) {
5+
; CHECK-LABEL: define void @f(
6+
; CHECK-SAME: i32 noundef [[V0:%.*]], i32 noundef [[V1:%.*]], i32 noundef [[V2:%.*]]) {
7+
; CHECK-NEXT: [[ENTRY:.*:]]
8+
; CHECK-NEXT: [[CMP0:%.*]] = icmp sge i32 [[V0]], [[V1]]
9+
; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i32 [[V1]], [[V2]]
10+
; CHECK-NEXT: [[AND1:%.*]] = and i1 [[CMP0]], [[CMP1]]
11+
; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[V0]], [[V2]]
12+
; CHECK-NEXT: [[AND2:%.*]] = and i1 [[CMP2]], [[AND1]]
13+
; CHECK-NEXT: br i1 [[AND2]], label %[[IF_THEN:.*]], label %[[RETURN:.*]]
14+
; CHECK: [[IF_THEN]]:
15+
; CHECK-NEXT: call void @side_effect()
16+
; CHECK-NEXT: br label %[[RETURN]]
17+
; CHECK: [[RETURN]]:
18+
; CHECK-NEXT: ret void
19+
;
20+
entry:
21+
%cmp0 = icmp sge i32 %v0, %v1
22+
%cmp1 = icmp sge i32 %v1, %v2
23+
%and1 = and i1 %cmp0, %cmp1
24+
%cmp2 = icmp slt i32 %v0, %v2
25+
%and2 = and i1 %cmp2, %and1
26+
br i1 %and2, label %if.then, label %return
27+
28+
if.then:
29+
call void @side_effect()
30+
br label %return
31+
32+
return:
33+
ret void
34+
}
35+
36+
declare void @side_effect()

0 commit comments

Comments
 (0)