<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 - opt -loop-idiom crashing with opt: ../lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1986: ... Assertion ... "Unexpected exit edges."' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=43687">43687</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt -loop-idiom crashing with opt: ../lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1986: ... Assertion ... "Unexpected exit edges."' 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>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=22676" name="attach_22676" title="f21.ll reproducer">attachment 22676</a> <a href="attachment.cgi?id=22676&action=edit" title="f21.ll reproducer">[details]</a></span>
f21.ll reproducer

Reproduce with:
 opt -S -o - f21.ll -loop-idiom

Result:

opt: ../lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1986: bool (anonymous
namespace)::LoopIdiomRecognize::recognizeBCmpLoopControlFlow(const (anonymous
namespace)::LoopIdiomRecognize::CmpOfLoads &, (anonymous
namespace)::LoopIdiomRecognize::CmpLoopStructure &) const: Assertion
`!is_contained(ExitBlocks, CmpLoop.HeaderBrEqualBB) && is_contained(ExitBlocks,
CmpLoop.HeaderBrUnequalBB) && !is_contained(ExitBlocks,
CmpLoop.LatchBrContinueBB) && is_contained(ExitBlocks, CmpLoop.LatchBrFinishBB)
&& "Unexpected exit edges."' failed.
Stack dump:
0.  Program arguments: /data/repo/master/llvm/build-all-builtins/bin/opt -S -o
- f21.ll -loop-idiom 
1.  Running pass 'Function Pass Manager' on module 'f21.ll'.
2.  Running pass 'Loop Pass Manager' on function '@main'
3.  Running pass 'Recognize loop idioms' on basic block '%for.body1163.1'
 #0 0x0000000003ebc1e4 PrintStackTraceSignalHandler(void*)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x3ebc1e4)
 #1 0x0000000003eb9f0e llvm::sys::RunSignalHandlers()
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x3eb9f0e)
 #2 0x0000000003ebc5e8 SignalHandler(int)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x3ebc5e8)
 #3 0x00007fbae2f2f890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007fbae19d8e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007fbae19da801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007fbae19ca39a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007fbae19ca412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x0000000003c91232 (anonymous
namespace)::LoopIdiomRecognize::detectBCmpIdiom(llvm::ICmpInst*&,
llvm::CmpInst*&, llvm::LoadInst*&, llvm::LoadInst*&, llvm::SCEV const*&,
llvm::SCEV const*&, llvm::SCEV const*&) const
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x3c91232)
 #9 0x0000000003c8c47c (anonymous
namespace)::LoopIdiomRecognize::recognizeBCmp()
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x3c8c47c)
#10 0x0000000003c859dc (anonymous
namespace)::LoopIdiomRecognize::runOnNoncountableLoop()
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x3c859dc)
#11 0x0000000003c827b7 (anonymous
namespace)::LoopIdiomRecognizeLegacyPass::runOnLoop(llvm::Loop*,
llvm::LPPassManager&)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x3c827b7)
#12 0x000000000315c2b2 llvm::LPPassManager::runOnFunction(llvm::Function&)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x315c2b2)
#13 0x0000000003792093 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x3792093)
#14 0x0000000003792378 llvm::FPPassManager::runOnModule(llvm::Module&)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x3792378)
#15 0x00000000037929dd llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x37929dd)
#16 0x00000000021506fd main
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x21506fd)
#17 0x00007fbae19bbb97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#18 0x000000000213402a _start
(/data/repo/master/llvm/build-all-builtins/bin/opt+0x213402a)
Abort (core dumped)</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>