File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
llvm/test/Transforms/ConstraintElimination Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -182,4 +182,31 @@ if.else:
182182 ret i1 false
183183}
184184
185+ ; We do not know the sign of %x, so we cannot infer nuw for %ext.
186+ define i1 @test_icmp_ult_trunc_nsw_icmp_trunc_nuw (i64 %x , i32 %y ) {
187+ ; CHECK-LABEL: define i1 @test_icmp_ult_trunc_nsw_icmp_trunc_nuw(
188+ ; CHECK-SAME: i64 [[X:%.*]], i32 [[Y:%.*]]) {
189+ ; CHECK-NEXT: [[EXT:%.*]] = trunc nsw i64 [[X]] to i32
190+ ; CHECK-NEXT: [[COND:%.*]] = icmp ult i32 [[Y]], [[EXT]]
191+ ; CHECK-NEXT: br i1 [[COND]], label %[[IF_THEN:.*]], label %[[IF_ELSE:.*]]
192+ ; CHECK: [[IF_THEN]]:
193+ ; CHECK-NEXT: [[CONV:%.*]] = zext i32 [[Y]] to i64
194+ ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[X]], [[CONV]]
195+ ; CHECK-NEXT: ret i1 [[CMP]]
196+ ; CHECK: [[IF_ELSE]]:
197+ ; CHECK-NEXT: ret i1 false
198+ ;
199+ %ext = trunc nsw i64 %x to i32
200+ %cond = icmp ult i32 %y , %ext
201+ br i1 %cond , label %if.then , label %if.else
202+
203+ if.then:
204+ %conv = zext i32 %y to i64
205+ %cmp = icmp eq i64 %x , %conv
206+ ret i1 %cmp
207+
208+ if.else:
209+ ret i1 false
210+ }
211+
185212declare void @cond ()
You can’t perform that action at this time.
0 commit comments