forked from OSchip/llvm-project
Temporarily disable term folding in LoopSimplifyCFG, add tests
llvm-svn: 350117
This commit is contained in:
parent
80e4b40f3e
commit
530ff8f3cc
|
@ -42,7 +42,7 @@ using namespace llvm;
|
|||
#define DEBUG_TYPE "loop-simplifycfg"
|
||||
|
||||
static cl::opt<bool> EnableTermFolding("enable-loop-simplifycfg-term-folding",
|
||||
cl::init(true));
|
||||
cl::init(false));
|
||||
|
||||
STATISTIC(NumTerminatorsFolded,
|
||||
"Number of terminators folded to unconditional branches");
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; XFAIL: *
|
||||
; Tests complex_dead_subloop_branch and complex_dead_subloop_switch fail an
|
||||
; assertion, therefore the CFG simplification is temporarily disabled.
|
||||
; REQUIRES: asserts
|
||||
; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -loop-simplifycfg -debug-only=loop-simplifycfg -verify-loop-info -verify-dom-info -verify-loop-lcssa 2>&1 < %s | FileCheck %s
|
||||
; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -passes='require<domtree>,loop(simplify-cfg)' -debug-only=loop-simplifycfg -verify-loop-info -verify-dom-info -verify-loop-lcssa 2>&1 < %s | FileCheck %s
|
||||
|
@ -2507,3 +2510,59 @@ loop_1_backedge:
|
|||
exit:
|
||||
ret i32 %i
|
||||
}
|
||||
|
||||
define i32 @complex_dead_subloop_branch(i1 %cond1, i1 %cond2, i1 %cond3) {
|
||||
entry:
|
||||
br label %loop
|
||||
|
||||
loop:
|
||||
br i1 true, label %latch, label %subloop
|
||||
|
||||
subloop:
|
||||
br i1 %cond1, label %x, label %y
|
||||
|
||||
x:
|
||||
br label %subloop_latch
|
||||
|
||||
y:
|
||||
br label %subloop_latch
|
||||
|
||||
subloop_latch:
|
||||
%dead_phi = phi i32 [ 1, %x ], [ 2, %y ]
|
||||
br i1 %cond2, label %latch, label %subloop
|
||||
|
||||
latch:
|
||||
%result = phi i32 [ 0, %loop ], [ %dead_phi, %subloop_latch ]
|
||||
br i1 %cond3, label %loop, label %exit
|
||||
|
||||
exit:
|
||||
ret i32 %result
|
||||
}
|
||||
|
||||
define i32 @complex_dead_subloop_switch(i1 %cond1, i1 %cond2, i1 %cond3) {
|
||||
entry:
|
||||
br label %loop
|
||||
|
||||
loop:
|
||||
switch i32 1, label %latch [ i32 0, label %subloop ]
|
||||
|
||||
subloop:
|
||||
br i1 %cond1, label %x, label %y
|
||||
|
||||
x:
|
||||
br label %subloop_latch
|
||||
|
||||
y:
|
||||
br label %subloop_latch
|
||||
|
||||
subloop_latch:
|
||||
%dead_phi = phi i32 [ 1, %x ], [ 2, %y ]
|
||||
br i1 %cond2, label %latch, label %subloop
|
||||
|
||||
latch:
|
||||
%result = phi i32 [ 0, %loop ], [ %dead_phi, %subloop_latch ]
|
||||
br i1 %cond3, label %loop, label %exit
|
||||
|
||||
exit:
|
||||
ret i32 %result
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue