diff options
author | Balaram Makam <bmakam@codeaurora.org> | 2017-07-19 08:53:34 +0000 |
---|---|---|
committer | Balaram Makam <bmakam@codeaurora.org> | 2017-07-19 08:53:34 +0000 |
commit | b05a55787a61e063f868fdb55c4f6fb0ee8bd618 (patch) | |
tree | 0d95b7006207ce4913dbb1c582564bfd17d1b8c3 /llvm/test/Transforms/LoopUnswitch/infinite-loop.ll | |
parent | 8c452d76ed7d3782d7a99eb22c61ef4191afa920 (diff) | |
download | bcm5719-llvm-b05a55787a61e063f868fdb55c4f6fb0ee8bd618.tar.gz bcm5719-llvm-b05a55787a61e063f868fdb55c4f6fb0ee8bd618.zip |
[SimplifyCFG] Defer folding unconditional branches to LateSimplifyCFG if it can destroy canonical loop structure.
Summary:
When simplifying unconditional branches from empty blocks, we pre-test if the
BB belongs to a set of loop headers and keep the block to prevent passes from
destroying canonical loop structure. However, the current algorithm fails if
the destination of the branch is a loop header. Especially when such a loop's
latch block is folded into loop header it results in additional backedges and
LoopSimplify turns it into a nested loop which prevent later optimizations
from being applied (e.g., loop unrolling and loop interleaving).
This patch augments the existing algorithm by further checking if the
destination of the branch belongs to a set of loop headers and defer
eliminating it if yes to LateSimplifyCFG.
Fixes PR33605: https://bugs.llvm.org/show_bug.cgi?id=33605
Reviewers: efriedma, mcrosier, pacxx, hsung, davidxl
Reviewed By: efriedma
Subscribers: ashutosh.nema, gberry, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D35411
llvm-svn: 308422
Diffstat (limited to 'llvm/test/Transforms/LoopUnswitch/infinite-loop.ll')
-rw-r--r-- | llvm/test/Transforms/LoopUnswitch/infinite-loop.ll | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/test/Transforms/LoopUnswitch/infinite-loop.ll b/llvm/test/Transforms/LoopUnswitch/infinite-loop.ll index 0aef9092a1f..af8725b02a1 100644 --- a/llvm/test/Transforms/LoopUnswitch/infinite-loop.ll +++ b/llvm/test/Transforms/LoopUnswitch/infinite-loop.ll @@ -6,7 +6,7 @@ ; Loop unswitching shouldn't trivially unswitch the true case of condition %a ; in the code here because it leads to an infinite loop. While this doesn't ; contain any instructions with side effects, it's still a kind of side effect. -; It can trivially unswitch on the false cas of condition %a though. +; It can trivially unswitch on the false case of condition %a though. ; STATS: 2 loop-unswitch - Number of branches unswitched ; STATS: 2 loop-unswitch - Number of unswitches that are trivial @@ -16,7 +16,7 @@ ; CHECK-NEXT: br i1 %a, label %entry.split, label %abort0.split ; CHECK: entry.split: -; CHECK-NEXT: br i1 %b, label %for.body, label %abort1.split +; CHECK-NEXT: br i1 %b, label %entry.split.split, label %abort1.split ; CHECK: for.body: ; CHECK-NEXT: br label %for.body |