[llvm] r350117 - Temporarily disable term folding in LoopSimplifyCFG, add tests
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 27 22:22:39 PST 2018
Author: mkazantsev
Date: Thu Dec 27 22:22:39 2018
New Revision: 350117
URL: http://llvm.org/viewvc/llvm-project?rev=350117&view=rev
Log:
Temporarily disable term folding in LoopSimplifyCFG, add tests
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
llvm/trunk/test/Transforms/LoopSimplifyCFG/constant-fold-branch.ll
Modified: llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp?rev=350117&r1=350116&r2=350117&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp Thu Dec 27 22:22:39 2018
@@ -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");
Modified: llvm/trunk/test/Transforms/LoopSimplifyCFG/constant-fold-branch.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopSimplifyCFG/constant-fold-branch.ll?rev=350117&r1=350116&r2=350117&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LoopSimplifyCFG/constant-fold-branch.ll (original)
+++ llvm/trunk/test/Transforms/LoopSimplifyCFG/constant-fold-branch.ll Thu Dec 27 22:22:39 2018
@@ -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
+}
More information about the llvm-commits
mailing list