<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 -memoryssa -loop-simplify -early-cse-memssa crashing with MemorySSA.cpp:2019: void llvm::MemorySSA::verifyDefUses(llvm::Function &) const: Assertion `find(predecessors(&B), Phi->getIncomingBlock(I)) != pred_end(&B) && "Incoming phi block not a block p"
   href="https://bugs.llvm.org/show_bug.cgi?id=41853">41853</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt -memoryssa -loop-simplify -early-cse-memssa crashing with MemorySSA.cpp:2019: void llvm::MemorySSA::verifyDefUses(llvm::Function &) const: Assertion `find(predecessors(&B), Phi->getIncomingBlock(I)) != pred_end(&B) && "Incoming phi block not a block p
          </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>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21938" name="attach_21938" title="Reproducer">attachment 21938</a> <a href="attachment.cgi?id=21938&action=edit" title="Reproducer">[details]</a></span>
Reproducer

Running
 opt -S -o - memssa.ll -memoryssa -loop-simplify -early-cse-memssa

yields

opt: ../lib/Analysis/MemorySSA.cpp:2019: void
llvm::MemorySSA::verifyDefUses(llvm::Function &) const: Assertion
`find(predecessors(&B), Phi->getIncomingBlock(I)) != pred_end(&B) && "Incoming
phi block not a block predecessor"' failed.
Stack dump:
0.      Program arguments: build-all/bin/opt -S -o - memssa.ll -memoryssa
-loop-simplify -early-cse-memssa 
1.      Running pass 'Function Pass Manager' on module 'memssa.ll'.
 #0 0x000000000237b634 PrintStackTraceSignalHandler(void*)
(build-all/bin/opt+0x237b634)
 #1 0x0000000002379600 llvm::sys::RunSignalHandlers()
(build-all/bin/opt+0x2379600)
 #2 0x000000000237b998 SignalHandler(int) (build-all/bin/opt+0x237b998)
 #3 0x00007fea800d6330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
 #4 0x00007fea7ecc5c37 raise
/build/eglibc-xkFqqE/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
 #5 0x00007fea7ecc9028 abort
/build/eglibc-xkFqqE/eglibc-2.19/stdlib/abort.c:91:0
 #6 0x00007fea7ecbebf6 __assert_fail_base
/build/eglibc-xkFqqE/eglibc-2.19/assert/assert.c:92:0
 #7 0x00007fea7ecbeca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
 #8 0x00000000017d1a5d llvm::MemorySSA::verifyDefUses(llvm::Function&) const
(build-all/bin/opt+0x17d1a5d)
 #9 0x00000000017d45c1 llvm::MemorySSAWrapperPass::verifyAnalysis() const
(build-all/bin/opt+0x17d45c1)
#10 0x0000000001d717a9
llvm::PMDataManager::verifyPreservedAnalysis(llvm::Pass*)
(build-all/bin/opt+0x1d717a9)
#11 0x0000000001d74f9f llvm::FPPassManager::runOnFunction(llvm::Function&)
(build-all/bin/opt+0x1d74f9f)
#12 0x0000000001d751d8 llvm::FPPassManager::runOnModule(llvm::Module&)
(build-all/bin/opt+0x1d751d8)
#13 0x0000000001d7567a llvm::legacy::PassManagerImpl::run(llvm::Module&)
(build-all/bin/opt+0x1d7567a)
#14 0x00000000007d936e main (build-all/bin/opt+0x7d936e)
#15 0x00007fea7ecb0f45 __libc_start_main
/build/eglibc-xkFqqE/eglibc-2.19/csu/libc-start.c:321:0
#16 0x00000000007bd9f9 _start (build-all/bin/opt+0x7bd9f9)
Abort


When the assertion fails we have:

(gdb) call F.dump()

define void @loop_imm_reg_plus2() {
  br i1 undef, label %bb5.preheader, label %bb3

bb5.preheader:                                    ; preds = %0
  br label %bb5

bb5:                                              ; preds = %bb5.preheader,
%bb5
  store i16 undef, i16* undef
  br i1 false, label %bb5, label %bb3.loopexit

bb3.loopexit:                                     ; preds = %bb5
  br label %bb3

bb3:                                              ; preds = %bb3.loopexit, %0
  ret void
}

(gdb) call B.getName()
$11 = "bb5"
(gdb) call Phi->dump()
2 = MemoryPhi({%0,liveOnEntry},{bb5,1})


This starts happening with r360270:

    [MemorySSA] Teach LoopSimplify to preserve MemorySSA.</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>