mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
e1717245c4
This patch adds a new option to CriticalEdgeSplittingOptions to control whether loop-simplify form must be preserved. It is them used by GVN to indicate that loop-simplify form does not have to be preserved. This fixes a crash exposed by 189efe295b6e. If the critical edge we are splitting goes from a block inside a loop to a block outside the loop, splitting the edge will create a new exit block. As a result, the new block will branch to the original exit block, which will add a non-loop predecessor, breaking loop-simplify form. To preserve loop-simplify form, the predecessor blocks of the original exit are split, but that does not work for blocks with indirectbr terminators. If preserving loop-simplify form is requested, bail out , before making any changes. Reviewers: reames, hfinkel, davide, efriedma Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D81582
57 lines
1.5 KiB
LLVM
57 lines
1.5 KiB
LLVM
; RUN: opt < %s -debug-pass=Structure -indvars -gvn -indvars 2>&1 -S | FileCheck --check-prefix=CHECK --check-prefix=IR %s
|
|
; RUN: opt < %s -debug-pass-manager -passes='require<domtree>,loop(simplify-cfg),gvn,loop(indvars)' 2>&1 -S | FileCheck --check-prefix=NEW-PM --check-prefix=IR %s
|
|
|
|
; Check CFG-only analysis are preserved by SCCP by running it between 2
|
|
; loop-vectorize runs.
|
|
|
|
; CHECK: Dominator Tree Construction
|
|
; CHECK: Natural Loop Information
|
|
; CHECK: Canonicalize natural loops
|
|
; CHECK: LCSSA Verifier
|
|
; CHECK: Loop-Closed SSA Form Pass
|
|
; CHECK: Global Value Numbering
|
|
; CHECK-NOT: Dominator Tree Construction
|
|
; CHECK-NOT: Natural Loop Information
|
|
; CHECK: Canonicalize natural loops
|
|
|
|
; NEW-PM-DAG: Running analysis: LoopAnalysis on test
|
|
; NEW-PM-DAG: Running analysis: DominatorTreeAnalysis on test
|
|
; NEW-PM: Running pass: GVN on test
|
|
; NEW-PM-NOT: Running analysis: LoopAnalysis on test
|
|
; NEW-PM-NOT: Running analysis: DominatorTreeAnalysis on test
|
|
|
|
declare i1 @cond()
|
|
declare void @dostuff()
|
|
|
|
define i32 @test() {
|
|
; IR-LABEL: define i32 @test()
|
|
; IR-LABEL: header:
|
|
; IR: br i1 false, label %then, label %latch
|
|
; IR-LABEL: then:
|
|
; IR-NEXT: call void @dostuff()
|
|
; IR-NEXT: br label %latch
|
|
entry:
|
|
%res = add i32 1, 10
|
|
br label %header
|
|
|
|
header:
|
|
%iv = phi i32 [ %res, %entry ], [ 0, %latch ]
|
|
%ic = icmp eq i32 %res, 99
|
|
br i1 %ic, label %then, label %latch
|
|
|
|
then:
|
|
br label %then.2
|
|
|
|
then.2:
|
|
call void @dostuff()
|
|
br label %latch
|
|
|
|
|
|
latch:
|
|
%ec = call i1 @cond()
|
|
br i1 %ec, label %exit, label %header
|
|
|
|
exit:
|
|
ret i32 %iv
|
|
}
|