1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt -S -passes='print<scalar-evolution>,loop(loop-unroll-full)' -verify-scev < %s 2>/dev/null | FileCheck %s
4 define i32 @test(ptr %arg) {
5 ; CHECK-LABEL: define i32 @test
6 ; CHECK-SAME: (ptr [[ARG:%.*]]) {
8 ; CHECK-NEXT: br label [[LOOP_PEEL_BEGIN:%.*]]
9 ; CHECK: loop.peel.begin:
10 ; CHECK-NEXT: br label [[LOOP_PEEL:%.*]]
12 ; CHECK-NEXT: [[LOAD_PEEL:%.*]] = load i32, ptr null, align 4
13 ; CHECK-NEXT: br i1 false, label [[LOOP_EXIT:%.*]], label [[LOOP_LATCH_PEEL:%.*]]
14 ; CHECK: loop.latch.peel:
15 ; CHECK-NEXT: br i1 false, label [[LOOP_EXIT]], label [[LOOP_PEEL_NEXT:%.*]]
16 ; CHECK: loop.peel.next:
17 ; CHECK-NEXT: br label [[LOOP_PEEL_NEXT1:%.*]]
18 ; CHECK: loop.peel.next1:
19 ; CHECK-NEXT: br label [[ENTRY_PEEL_NEWPH:%.*]]
20 ; CHECK: entry.peel.newph:
21 ; CHECK-NEXT: br label [[LOOP:%.*]]
23 ; CHECK-NEXT: [[LOAD:%.*]] = load i32, ptr null, align 4
24 ; CHECK-NEXT: br i1 false, label [[LOOP_EXIT_LOOPEXIT:%.*]], label [[LOOP_LATCH:%.*]]
26 ; CHECK-NEXT: br i1 false, label [[LOOP_EXIT_LOOPEXIT]], label [[LOOP]], !llvm.loop [[LOOP0:![0-9]+]]
27 ; CHECK: loop.exit.loopexit:
28 ; CHECK-NEXT: [[EXITVAL_PH:%.*]] = phi i32 [ [[LOAD]], [[LOOP]] ], [ 0, [[LOOP_LATCH]] ]
29 ; CHECK-NEXT: br label [[LOOP_EXIT]]
31 ; CHECK-NEXT: [[EXITVAL:%.*]] = phi i32 [ [[LOAD_PEEL]], [[LOOP_PEEL]] ], [ 0, [[LOOP_LATCH_PEEL]] ], [ [[EXITVAL_PH]], [[LOOP_EXIT_LOOPEXIT]] ]
32 ; CHECK-NEXT: ret i32 [[EXITVAL]]
38 %iv = phi ptr [ %arg, %loop.latch ], [ null, %entry ]
39 %load = load i32, ptr null, align 4
40 br i1 false, label %loop.exit, label %loop.latch
43 br i1 false, label %loop.exit, label %loop
46 %exitval = phi i32 [ 0, %loop.latch ], [ %load, %loop ]