1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -S -passes=loop-unroll-full -unroll-full-max-count=1 %s | FileCheck %s
@GlobIntONE = global i32 0, align 4
; Make sure we don't reuse the phi (undef, X) for X.
define ptr @test() {
; CHECK-LABEL: define ptr @test() {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: br label %[[FOR_BODY_PEEL_BEGIN:.*]]
; CHECK: [[FOR_BODY_PEEL_BEGIN]]:
; CHECK-NEXT: br label %[[FOR_BODY_PEEL:.*]]
; CHECK: [[FOR_BODY_PEEL]]:
; CHECK-NEXT: br i1 true, label %[[CLEANUP_PEEL:.*]], label %[[CLEANUP_LOOPEXIT_PEEL:.*]]
; CHECK: [[CLEANUP_LOOPEXIT_PEEL]]:
; CHECK-NEXT: br label %[[CLEANUP_PEEL]]
; CHECK: [[CLEANUP_PEEL]]:
; CHECK-NEXT: [[RETVAL_2_PEEL:%.*]] = phi ptr [ undef, %[[FOR_BODY_PEEL]] ], [ @GlobIntONE, %[[CLEANUP_LOOPEXIT_PEEL]] ]
; CHECK-NEXT: br i1 true, label %[[FOR_BODY_PEEL_NEXT:.*]], label %[[CLEANUP2:.*]]
; CHECK: [[FOR_BODY_PEEL_NEXT]]:
; CHECK-NEXT: br label %[[FOR_BODY_PEEL_NEXT1:.*]]
; CHECK: [[FOR_BODY_PEEL_NEXT1]]:
; CHECK-NEXT: br label %[[ENTRY_PEEL_NEWPH:.*]]
; CHECK: [[ENTRY_PEEL_NEWPH]]:
; CHECK-NEXT: br label %[[FOR_BODY:.*]]
; CHECK: [[FOR_BODY]]:
; CHECK-NEXT: br i1 false, label %[[CLEANUP:.*]], label %[[CLEANUP_LOOPEXIT:.*]]
; CHECK: [[CLEANUP_LOOPEXIT]]:
; CHECK-NEXT: br label %[[CLEANUP]]
; CHECK: [[CLEANUP]]:
; CHECK-NEXT: br i1 false, label %[[FOR_BODY]], label %[[CLEANUP2_LOOPEXIT:.*]], !llvm.loop [[LOOP0:![0-9]+]]
; CHECK: [[CLEANUP2_LOOPEXIT]]:
; CHECK-NEXT: [[RETVAL_2_LCSSA_PH:%.*]] = phi ptr [ @GlobIntONE, %[[CLEANUP]] ]
; CHECK-NEXT: br label %[[CLEANUP2]]
; CHECK: [[CLEANUP2]]:
; CHECK-NEXT: [[RETVAL_2_LCSSA:%.*]] = phi ptr [ [[RETVAL_2_PEEL]], %[[CLEANUP_PEEL]] ], [ [[RETVAL_2_LCSSA_PH]], %[[CLEANUP2_LOOPEXIT]] ]
; CHECK-NEXT: ret ptr [[RETVAL_2_LCSSA]]
;
entry:
br label %for.body
for.body:
%retval.0 = phi ptr [ undef, %entry ], [ %retval.2, %cleanup ]
%cmp1.not = phi i1 [ true, %entry ], [ false, %cleanup ]
br i1 %cmp1.not, label %cleanup, label %cleanup.loopexit
cleanup.loopexit:
br label %cleanup
cleanup:
%retval.2 = phi ptr [ %retval.0, %for.body ], [ @GlobIntONE, %cleanup.loopexit ]
br i1 %cmp1.not, label %for.body, label %cleanup2
cleanup2:
%retval.2.lcssa = phi ptr [ %retval.2, %cleanup ]
ret ptr %retval.2.lcssa
}
;.
; CHECK: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]]}
; CHECK: [[META1]] = !{!"llvm.loop.peeled.count", i32 1}
;.
|