[llvm-bugs] [Bug 38737] New: simple loop unswitch asserts after nontrivial unswitch: Assertion `false && "Unreachable block in loop"' failed.
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Aug 28 06:53:32 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38737
Bug ID: 38737
Summary: simple loop unswitch asserts after nontrivial
unswitch: Assertion `false && "Unreachable block in
loop"' failed.
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Loop Optimizer
Assignee: unassignedbugs at nondot.org
Reporter: fedor.v.sergeev at gmail.com
CC: llvm-bugs at lists.llvm.org
reduced IR:
] cat bad-unswitch-reduced.ll
declare void @foo()
define void @Test(i32) {
entry:
br label %outer
outer:
%oi = phi i32 [ 0, %entry ], [ %oinc, %outer_continue]
br label %inner
inner:
%ii = phi i32 [ 0, %outer ], [ %iinc, %continue]
call void @foo()
switch i32 %0, label %get_out2 [
i32 0, label %continue
i32 1, label %case1
i32 2, label %get_out
]
case1:
br label %continue
continue:
%iinc = add i32 %ii, 1
%icmp = icmp eq i32 %ii, 100
br i1 %icmp, label %inner, label %outer_continue
outer_continue:
%oinc = add i32 %oi, 1
%ocmp = icmp eq i32 %oi, 100
br i1 %ocmp, label %outer, label %get_out
get_out:
ret void
get_out2:
unreachable
}
] ~/work/llvm-upstream/builds/linux-debug/bin/opt -simple-loop-unswitch
-enable-nontrivial-unswitch bad-unswitch-reduced.ll -disable-output
The following blocks are unreachable in the loop:
outer_continue.split.split: ; No predecessors!
br label %outer_continue.split
opt: ~/work/llvm-upstream/llvm/include/llvm/Analysis/LoopInfoImpl.h:359: void
llvm::LoopBase<N, M>::verifyLoop() const [with BlockT = llvm::BasicBlock; LoopT
= llvm::Loop]: Assertion `false && "Unreachable block in loop"' failed.
Stack dump:
0. Program arguments: ~/work/llvm-upstream/builds/linux-debug/bin/opt
-simple-loop-unswitch -enable-nontrivial-unswitch bad-unswitch-reduced.ll
-disable-output
1. Running pass 'Function Pass Manager' on module
'bad-unswitch-reduced.ll'.
2. Running pass 'Loop Pass Manager' on function '@Test'
3. Running pass 'Simple unswitch loops' on basic block '%inner'
#0 0x00007f69c9e6181e llvm::sys::PrintStackTrace(llvm::raw_ostream&)
~/work/llvm-upstream/llvm/lib/Support/Unix/Signals.inc:490:0
#1 0x00007f69c9e618af PrintStackTraceSignalHandler(void*)
~/work/llvm-upstream/llvm/lib/Support/Unix/Signals.inc:554:0
#2 0x00007f69c9e5f8bf llvm::sys::RunSignalHandlers()
~/work/llvm-upstream/llvm/lib/Support/Signals.cpp:67:0
#3 0x00007f69c9e612bf SignalHandler(int)
~/work/llvm-upstream/llvm/lib/Support/Unix/Signals.inc:353:0
#4 0x00007f69c786d390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#5 0x00007f69c6c26428 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35428)
#6 0x00007f69c6c2802a abort (/lib/x86_64-linux-gnu/libc.so.6+0x3702a)
#7 0x00007f69c6c1ebd7 (/lib/x86_64-linux-gnu/libc.so.6+0x2dbd7)
#8 0x00007f69c6c1ec82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#9 0x00007f69cb527bf9 llvm::LoopBase<llvm::BasicBlock,
llvm::Loop>::verifyLoop() const
~/work/llvm-upstream/llvm/include/llvm/Analysis/LoopInfoImpl.h:363:0
#10 0x00007f69cb1132be unswitchNontrivialInvariants(llvm::Loop&,
llvm::TerminatorInst&, llvm::ArrayRef<llvm::Value*>, llvm::DominatorTree&,
llvm::LoopInfo&, llvm::AssumptionCache&, llvm::function_ref<void (bool,
llvm::ArrayRef<llvm::Loop*>)>,
llvm::ScalarEvolution*)::'lambda1'(llvm::Loop&)::operator()(llvm::Loop&) const
~/work/llvm-upstream/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2080:0
#11 0x00007f69cb114b3e unswitchNontrivialInvariants(llvm::Loop&,
llvm::TerminatorInst&, llvm::ArrayRef<llvm::Value*>, llvm::DominatorTree&,
llvm::LoopInfo&, llvm::AssumptionCache&, llvm::function_ref<void (bool,
llvm::ArrayRef<llvm::Loop*>)>, llvm::ScalarEvolution*)
~/work/llvm-upstream/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2119:0
#12 0x00007f69cb115fdc unswitchBestCondition(llvm::Loop&, llvm::DominatorTree&,
llvm::LoopInfo&, llvm::AssumptionCache&, llvm::TargetTransformInfo&,
llvm::function_ref<void (bool, llvm::ArrayRef<llvm::Loop*>)>,
llvm::ScalarEvolution*)
~/work/llvm-upstream/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2371:0
#13 0x00007f69cb11617a unswitchLoop(llvm::Loop&, llvm::DominatorTree&,
llvm::LoopInfo&, llvm::AssumptionCache&, llvm::TargetTransformInfo&, bool,
llvm::function_ref<void (bool, llvm::ArrayRef<llvm::Loop*>)>,
llvm::ScalarEvolution*)
~/work/llvm-upstream/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2429:0
#14 0x00007f69cb1167e4 (anonymous
namespace)::SimpleLoopUnswitchLegacyPass::runOnLoop(llvm::Loop*,
llvm::LPPassManager&)
~/work/llvm-upstream/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2530:0
...
]
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180828/30fa4923/attachment.html>
More information about the llvm-bugs
mailing list