1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=loop-bound-split -S < %s | FileCheck %s
4 ; LoopBoundSplit pass should fail to split this test's loop because the split
5 ; condition is false in first iteration of the loop.
7 define i16 @main(i16 %qqq) {
10 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
12 ; CHECK-NEXT: [[T0:%.*]] = phi i16 [ 0, [[ENTRY:%.*]] ], [ [[T8:%.*]], [[CONT19:%.*]] ]
13 ; CHECK-NEXT: [[T1:%.*]] = shl nuw nsw i16 [[T0]], 1
14 ; CHECK-NEXT: [[T2:%.*]] = add i16 [[T1]], [[QQQ:%.*]]
15 ; CHECK-NEXT: [[DOTNOT9:%.*]] = icmp ult i16 [[T2]], [[QQQ]]
16 ; CHECK-NEXT: br i1 [[DOTNOT9]], label [[HANDLER_POINTER_OVERFLOW:%.*]], label [[CONT15_CRITEDGE:%.*]]
17 ; CHECK: handler.pointer_overflow:
18 ; CHECK-NEXT: call void @__ubsan_handle_pointer_overflow()
19 ; CHECK-NEXT: br label [[CONT19]]
20 ; CHECK: cont15.critedge:
21 ; CHECK-NEXT: br label [[CONT19]]
23 ; CHECK-NEXT: [[T8]] = add nuw nsw i16 [[T0]], 1
24 ; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i16 [[T8]], 3
25 ; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY]]
26 ; CHECK: for.cond.cleanup:
27 ; CHECK-NEXT: ret i16 0
33 %t0 = phi i16 [ 0, %entry ], [ %t8, %cont19 ]
34 %t1 = shl nuw nsw i16 %t0, 1
35 %t2 = add i16 %t1, %qqq
36 %.not9 = icmp ult i16 %t2, %qqq
37 br i1 %.not9, label %handler.pointer_overflow, label %cont15.critedge
39 handler.pointer_overflow:
40 call void @__ubsan_handle_pointer_overflow()
47 %t8 = add nuw nsw i16 %t0, 1
48 %exitcond.not = icmp eq i16 %t8, 3
49 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
55 declare dso_local void @__ubsan_handle_pointer_overflow()