<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 - Assertion `!isInvalid() && "Loop not in a valid state!"' failed. with -simple-loop-unswitch -loop-deletion"
href="https://bugs.llvm.org/show_bug.cgi?id=37888">37888</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Assertion `!isInvalid() && "Loop not in a valid state!"' failed. with -simple-loop-unswitch -loop-deletion
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mikael.holmen@ericsson.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=20453" name="attach_20453" title="reproducer">attachment 20453</a> <a href="attachment.cgi?id=20453&action=edit" title="reproducer">[details]</a></span>
reproducer
Running
opt -S -o - bbi-14637.ll -simple-loop-unswitch -loop-deletion
gives
opt: ../include/llvm/Analysis/LoopInfo.h:150: ArrayRef<BlockT *>
llvm::LoopBase<llvm::BasicBlock, llvm::Loop>::getBlocks() const [BlockT =
llvm::BasicBlock, LoopT = llvm::Loop]: Assertion `!isInvalid() && "Loop not in
a valid state!"' failed.
Stack dump:
0. Program arguments: opt -S -o - bbi-14637.ll -simple-loop-unswitch
-loop-deletion
1. Running pass 'Function Pass Manager' on module 'bbi-14637.ll'.
2. Running pass 'Loop Pass Manager' on function '@f1'
LLVMSymbolizer: error reading file: No such file or directory
#0 0x0000000001feeab4 (opt+0x1feeab4)
#1 0x0000000001fecd20 (opt+0x1fecd20)
#2 0x0000000001feee18 (opt+0x1feee18)
#3 0x00007fb858479330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007fb857068c37 gsignal
/build/eglibc-ripdx6/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fb85706c028 abort
/build/eglibc-ripdx6/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fb857061bf6 __assert_fail_base
/build/eglibc-ripdx6/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fb857061ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x000000000152f7e2 (opt+0x152f7e2)
#9 0x0000000001a79d4a (opt+0x1a79d4a)
#10 0x0000000001a79fa8 (opt+0x1a79fa8)
#11 0x0000000001a7a4dd (opt+0x1a7a4dd)
#12 0x00000000007454cc (opt+0x7454cc)
#13 0x00007fb857053f45 __libc_start_main
/build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:321:0
#14 0x000000000072e82d (opt+0x72e82d)
Abort
With -debug-pass=Executions we get
Pass Arguments: -targetlibinfo -tti -targetpassconfig
-assumption-cache-tracker -domtree -loops -loop-simplify -lcssa-verification
-lcssa -basicaa -aa -scalar-evolution -simple-loop-unswitch -loop-deletion
-verify -print-module
Target Library Information
Target Transform Information
Target Pass Configuration
Assumption Cache Tracker
ModulePass Manager
FunctionPass Manager
Dominator Tree Construction
Natural Loop Information
Canonicalize natural loops
LCSSA Verifier
Loop-Closed SSA Form Pass
Basic Alias Analysis (stateless AA impl)
Function Alias Analysis Results
Scalar Evolution Analysis
Loop Pass Manager
Simple unswitch loops
Delete dead loops
Module Verifier
Print Module IR
[2018-06-13 08:49:54.217778133] 0x4332600 Executing Pass 'Function Pass
Manager' on Module 'bbi-14637.ll'...
[2018-06-13 08:49:54.217895120] 0x4360730 Executing Pass 'Dominator Tree
Construction' on Function 'f1'...
[2018-06-13 08:49:54.217935699] 0x4360730 Executing Pass 'Natural Loop
Information' on Function 'f1'...
[2018-06-13 08:49:54.217994577] 0x4360730 Executing Pass 'Canonicalize
natural loops' on Function 'f1'...
[2018-06-13 08:49:54.218053804] 0x4360730 Made Modification 'Canonicalize
natural loops' on Function 'f1'...
[2018-06-13 08:49:54.218087119] 0x4360730 Executing Pass 'LCSSA Verifier'
on Function 'f1'...
[2018-06-13 08:49:54.218119526] 0x4360730 Executing Pass 'Loop-Closed SSA
Form Pass' on Function 'f1'...
[2018-06-13 08:49:54.218171420] 0x4360730 Executing Pass 'Basic Alias
Analysis (stateless AA impl)' on Function 'f1'...
[2018-06-13 08:49:54.218216469] 0x4360730 Executing Pass 'Function Alias
Analysis Results' on Function 'f1'...
[2018-06-13 08:49:54.218262635] 0x4360730 Executing Pass 'Scalar Evolution
Analysis' on Function 'f1'...
[2018-06-13 08:49:54.218319557] 0x4360730 Executing Pass 'Loop Pass
Manager' on Function 'f1'...
[2018-06-13 08:49:54.218355946] 0x4361cc0 Executing Pass 'Simple unswitch
loops' on Loop 'for.body'...
[2018-06-13 08:49:54.220672155] 0x4361cc0 Made Modification 'Simple
unswitch loops' on Loop 'for.body'...
[2018-06-13 08:49:54.220740042] 0x4361cc0 Freeing Pass 'Simple unswitch
loops' on Loop 'for.body'...
[2018-06-13 08:49:54.220760856] 0x4361cc0 Executing Pass 'Delete dead
loops' on Loop 'for.body'...
[2018-06-13 08:49:54.220917514] 0x4361cc0 Made Modification 'Delete dead
loops' on Loop '<deleted loop>'...
[2018-06-13 08:49:54.220942727] 0x4361cc0 Freeing Pass 'Delete dead
loops' on Loop '<deleted>'...
[2018-06-13 08:49:54.220961096] 0x4361cc0 Freeing Pass 'Simple unswitch
loops' on Loop '<deleted>'...
[2018-06-13 08:49:54.220979325] 0x4361cc0 Freeing Pass 'Delete dead
loops' on Loop '<deleted>'...
opt: ../include/llvm/Analysis/LoopInfo.h:150: ArrayRef<BlockT *>
llvm::LoopBase<llvm::BasicBlock, llvm::Loop>::getBlocks() const [BlockT =
llvm::BasicBlock, LoopT = llvm::Loop]: Assertion `!isInvalid() && "Loop not in
a valid state!"' failed.
This started happening with r333493:
[PM/LoopUnswitch] When using the new SimpleLoopUnswitch pass, schedule
loop-cleanup passes at the beginning of the loop pass pipeline, and
re-enqueue loops after even trivial unswitching.
This will allow us to much more consistently avoid simplifying code
while doing trivial unswitching. I've also added a test case that
specifically shows effective iteration using this technique.
I've unconditionally updated the new PM as that is always using the
SimpleLoopUnswitch pass, and I've made the pipeline changes for the old
PM conditional on using this new unswitch pass. I added a bunch of
comments to the loop pass pipeline in the old PM to make it more clear
what is going on when reviewing.
Hopefully this will unblock doing *partial* unswitching instead of just
full unswitching.
Differential Revision: <a href="https://reviews.llvm.org/D47408">https://reviews.llvm.org/D47408</a></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>