mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
d6cc630830
Loop peeling as a last step triggers loop simplification and this can change the loop structure. As a result all cashed values like latch branch becomes invalid. Patch re-structure the code to take into account the possible changes caused by peeling. Reviewers: dmgreen, Meinersbur, etiotto, fhahn, efriedma, bmahjour Reviewed By: Meinersbur, fhahn Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D93686
49 lines
1.8 KiB
LLVM
49 lines
1.8 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -passes=loop-unroll -S | FileCheck %s
|
|
|
|
define i64 @hoge(i1 %c) {
|
|
; CHECK-LABEL: @hoge(
|
|
; CHECK-NEXT: bb:
|
|
; CHECK-NEXT: br label [[BB1_PEEL_BEGIN:%.*]]
|
|
; CHECK: bb1.peel.begin:
|
|
; CHECK-NEXT: br label [[BB1_PEEL:%.*]]
|
|
; CHECK: bb1.peel:
|
|
; CHECK-NEXT: br i1 [[C:%.*]], label [[BB2_PEEL:%.*]], label [[BB4:%.*]]
|
|
; CHECK: bb2.peel:
|
|
; CHECK-NEXT: [[TMP3_PEEL:%.*]] = icmp slt i32 0, 9
|
|
; CHECK-NEXT: br i1 [[TMP3_PEEL]], label [[BB1_PEEL_NEXT:%.*]], label [[BB4]]
|
|
; CHECK: bb1.peel.next:
|
|
; CHECK-NEXT: br label [[BB1_PEEL_NEXT1:%.*]]
|
|
; CHECK: bb1.peel.next1:
|
|
; CHECK-NEXT: br label [[BB_PEEL_NEWPH:%.*]]
|
|
; CHECK: bb.peel.newph:
|
|
; CHECK-NEXT: br label [[BB1:%.*]]
|
|
; CHECK: bb1:
|
|
; CHECK-NEXT: br i1 [[C]], label [[BB1]], label [[BB4_LOOPEXIT:%.*]], [[LOOP0:!llvm.loop !.*]]
|
|
; CHECK: bb4.loopexit:
|
|
; CHECK-NEXT: [[TMP5_PH:%.*]] = phi i32 [ 8, [[BB1]] ]
|
|
; CHECK-NEXT: br label [[BB4]]
|
|
; CHECK: bb4:
|
|
; CHECK-NEXT: [[TMP5:%.*]] = phi i32 [ 0, [[BB1_PEEL]] ], [ 8, [[BB2_PEEL]] ], [ [[TMP5_PH]], [[BB4_LOOPEXIT]] ]
|
|
; CHECK-NEXT: [[TMP6:%.*]] = call i64 (...) @llvm.experimental.deoptimize.i64(i32 10) [ "deopt"() ]
|
|
; CHECK-NEXT: ret i64 [[TMP6]]
|
|
;
|
|
bb:
|
|
br label %bb1
|
|
|
|
bb1: ; preds = %bb2, %bb
|
|
%tmp = phi i32 [ 8, %bb2 ], [ 0, %bb ]
|
|
br i1 %c, label %bb2, label %bb4
|
|
|
|
bb2: ; preds = %bb1
|
|
%tmp3 = icmp slt i32 %tmp, 9
|
|
br i1 %tmp3, label %bb1, label %bb4
|
|
|
|
bb4: ; preds = %bb2, %bb1
|
|
%tmp5 = phi i32 [ 8, %bb2 ], [ %tmp, %bb1 ]
|
|
%tmp6 = call i64 (...) @llvm.experimental.deoptimize.i64(i32 10) [ "deopt"() ]
|
|
ret i64 %tmp6
|
|
}
|
|
|
|
declare i64 @llvm.experimental.deoptimize.i64(...)
|