https://bugs.llvm.org/show_bug.cgi?id=41853

            Bug ID: 41853
           Summary: 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
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: mikael.hol...@ericsson.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org

Created attachment 21938
  --> https://bugs.llvm.org/attachment.cgi?id=21938&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to