• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -S -loop-unroll -unroll-force-peel-count=1 -verify-scev -verify-dom-info | FileCheck %s
3
4
5define void @test1(i32 %k) {
6; CHECK-LABEL: @test1(
7; CHECK-NEXT:  entry:
8; CHECK-NEXT:    br label [[FOR_BODY_PEEL_BEGIN:%.*]]
9; CHECK:       for.body.peel.begin:
10; CHECK-NEXT:    br label [[FOR_BODY_PEEL:%.*]]
11; CHECK:       for.body.peel:
12; CHECK-NEXT:    [[INC_PEEL:%.*]] = add nsw i32 0, 1
13; CHECK-NEXT:    [[CMP_PEEL:%.*]] = icmp ult i32 0, [[K:%.*]]
14; CHECK-NEXT:    br i1 [[CMP_PEEL]], label [[FOR_BODY_PEEL_NEXT:%.*]], label [[FOR_END:%.*]]
15; CHECK:       for.body.peel.next:
16; CHECK-NEXT:    br label [[FOR_BODY_PEEL_NEXT1:%.*]]
17; CHECK:       for.body.peel.next1:
18; CHECK-NEXT:    br label [[ENTRY_PEEL_NEWPH:%.*]]
19; CHECK:       entry.peel.newph:
20; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
21; CHECK:       for.body:
22; CHECK-NEXT:    [[I_05:%.*]] = phi i32 [ [[INC_PEEL]], [[ENTRY_PEEL_NEWPH]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
23; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_05]], 1
24; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[I_05]], [[K]]
25; CHECK-NEXT:    br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END_LOOPEXIT:%.*]], !llvm.loop !0
26; CHECK:       for.end.loopexit:
27; CHECK-NEXT:    br label [[FOR_END]]
28; CHECK:       for.end:
29; CHECK-NEXT:    ret void
30;
31entry:
32  br label %for.body
33
34for.body:
35  %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
36  %inc = add nsw i32 %i.05, 1
37  %cmp = icmp ult i32 %i.05, %k
38  br i1 %cmp, label %for.body, label %for.end
39
40for.end:
41  ret void
42}
43