1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00
llvm-mirror/test/Transforms/Reassociate/2012-06-08-InfiniteLoop.ll
Duncan Sands e6b780ada5 Revert commit 158073 while waiting for a fix. The issue is that reassociate
can move instructions within the instruction list.  If the instruction just
happens to be the one the basic block iterator is pointing to, and it is
moved to a different basic block, then we get into an infinite loop due to
the iterator running off the end of the basic block (for some reason this
doesn't fire any assertions).  Original commit message:

Grab-bag of reassociate tweaks.  Unify handling of dead instructions and
instructions to reoptimize.  Exploit this to more systematically eliminate
dead instructions (this isn't very useful in practice but is convenient for
analysing some testcase I am working on).  No need for WeakVH any more: use
an AssertingVH instead.

llvm-svn: 158199
2012-06-08 13:37:30 +00:00

22 lines
631 B
LLVM

; RUN: opt < %s -reassociate -disable-output
; PR13041
define void @foo() {
entry:
br label %while.cond
while.cond: ; preds = %while.body, %entry
%b.0 = phi i32 [ undef, %entry ], [ %sub2, %while.body ]
%c.0 = phi i32 [ undef, %entry ], [ %sub3, %while.body ]
br i1 undef, label %while.end, label %while.body
while.body: ; preds = %while.cond
%sub = sub nsw i32 0, %b.0
%sub2 = sub nsw i32 %sub, %c.0
%sub3 = sub nsw i32 0, %c.0
br label %while.cond
while.end: ; preds = %while.cond
ret void
}