https://bugs.llvm.org/show_bug.cgi?id=35884
Bug ID: 35884
Summary: LoopDeletion causes an assert `use_empty() && "Uses
remain when a value is destroyed!"'
Product: libraries
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Loop Optimizer
Assignee: unassignedb...@nondot.org
Reporter: serguei.kat...@azul.com
CC: llvm-bugs@lists.llvm.org
For the following simple reproducer:
define i64 @foo() {
entry:
br label %badloop
badloop:
%indvar1 = phi i64 [ 3, %entry ], [ %indvar2, %badloop_iter ]
%check = icmp ult i64 %indvar1, 400
br i1 %check, label %badloop_iter, label %loopexit
badloop_iter:
%indvar2 = add i64 %indvar1, 1
%baddef = add i64 0, 0
br label %badloop
loopexit:
ret i64 0
deadcode:
ret i64 %baddef
}
> opt -S -loop-deletion test.ll
While deleting: i64 %baddef
Use still stuck around after Def is destroyed: ret i64 %baddef
opt: ../../lib/IR/Value.cpp:92: llvm::Value::~Value(): Assertion `use_empty()
&& "Uses remain when a value is destroyed!"' failed.
The cause of this is that %baddef is defined in BB which does not dominate exit
and as a result LCCSA does not create a Phi node for it.
As a result LoopDeletion detects that loop is invariant and tries to delete it.
Assert happens when %baddef instruction is deleted due to it has use in
unreachable block.
The IR is well-formed because %baddef dominates all instructions in unreachable
block.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs