llvm/test/Transforms/LoopUnroll/update-loop-info-in-subloops.ll
Chandler Carruth f541c74552 [PM] Teach LoopUnroll to update the LPM infrastructure as it unrolls
loops.

We do this by reconstructing the newly added loops after the unroll
completes to avoid threading pass manager details through all the mess
of the unrolling infrastructure.

I've enabled some extra assertions in the LPM to try and catch issues
here and enabled a bunch of unroller tests to try and make sure this is
sane.

Currently, I'm manually running loop-simplify when needed. That should
go away once it is folded into the LPM infrastructure.

Differential Revision: https://reviews.llvm.org/D28848

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293011 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-25 02:49:01 +00:00

37 lines
738 B
LLVM

; RUN: opt -S < %s -loop-unroll -block-freq | FileCheck %s
; RUN: opt -S < %s -passes='require<opt-remark-emit>,loop(unroll),require<block-freq>' | FileCheck %s
; Crasher from PR20987.
; CHECK: define void @update_loop_info_in_subloops
; CHECK: entry:
; CHECK: L:
; CHECK: L.inner:
; CHECK: L.inner.latch:
; CHECK: L.latch:
; CHECK: L.inner.1:
; CHECK: L.inner.latch.1:
; CHECK: L.latch.1:
define void @update_loop_info_in_subloops() {
entry:
br label %L
L:
%0 = phi i64 [ 1, %entry ], [ %1, %L.latch ]
br label %L.inner
L.inner:
br label %L.inner.latch
L.inner.latch:
br i1 false, label %L.latch, label %L.inner
L.latch:
%1 = add i64 %0, 1
%2 = icmp eq i64 %1, 3
br i1 %2, label %exit, label %L
exit:
ret void
}