Temporarily disable term folding in LoopSimplifyCFG, add tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350117 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Max Kazantsev
2018-12-28 06:22:39 +00:00
parent 9800ccf353
commit c489b656e8
2 changed files with 60 additions and 1 deletions
@@ -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
}