Skip to content

Commit e951a48

Browse files
committed
Add freeze(and x, const) case to codegenprepare's freeze-cmp.ll
1 parent 28a42dd commit e951a48

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

llvm/test/Transforms/CodeGenPrepare/X86/freeze-cmp.ll

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,31 @@ define i1 @fcmp_nan(float %a) {
105105
ret i1 %fr
106106
}
107107

108+
define void @and(i32 %flag) {
109+
; CHECK-LABEL: @and(
110+
; CHECK-NEXT: [[V:%.*]] = and i32 [[FLAG:%.*]], 1
111+
; CHECK-NEXT: [[FR:%.*]] = freeze i32 [[V]]
112+
; CHECK-NEXT: [[C:%.*]] = icmp eq i32 [[FR]], 0
113+
; CHECK-NEXT: br i1 [[C]], label [[A:%.*]], label [[B:%.*]]
114+
; CHECK: A:
115+
; CHECK-NEXT: call void @g1()
116+
; CHECK-NEXT: ret void
117+
; CHECK: B:
118+
; CHECK-NEXT: call void @g2()
119+
; CHECK-NEXT: ret void
120+
;
121+
%v = and i32 %flag, 1
122+
%c = icmp eq i32 %v, 0
123+
%fr = freeze i1 %c
124+
br i1 %fr, label %A, label %B
125+
A:
126+
call void @g1()
127+
ret void
128+
B:
129+
call void @g2()
130+
ret void
131+
}
132+
133+
108134
declare void @g1()
109135
declare void @g2()

0 commit comments

Comments
 (0)