<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - simple loop unswitch asserts after nontrivial unswitch: Assertion `false && "Unreachable block in loop"' failed."
href="https://bugs.llvm.org/show_bug.cgi?id=38737">38737</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>simple loop unswitch asserts after nontrivial unswitch: Assertion `false && "Unreachable block in loop"' failed.
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Loop Optimizer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>fedor.v.sergeev@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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
...
]</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>