[llvm-bugs] [Bug 47753] New: opt -indvars -loop-deletion crashing with "Trip Count for Loop [...] Changed!"

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 7 05:14:55 PDT 2020


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

            Bug ID: 47753
           Summary: opt -indvars -loop-deletion crashing with "Trip Count
                    for Loop [...] Changed!"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24030
  --> https://bugs.llvm.org/attachment.cgi?id=24030&action=edit
bbi -48247.ll reproducer

llvm commit: dce03e3059f

Reproduce with:
 opt -S -o - bbi-48247.ll -indvars -loop-deletion

Result:
Trip Count for Loop at depth 1 containing:
%arrayinit.body11.i<header><latch><exiting>
 Changed!
Old: 9223372036854775807
New: 0
Delta: 9223372036854775807
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0.      Program arguments: ../../master/llvm/build-all/bin/opt -S -o -
bbi-48247.ll -indvars -loop-deletion 
1.      Running pass 'Function Pass Manager' on module 'bbi-48247.ll'.
2.      Running pass 'Loop Pass Manager' on function '@g'
3.      Running pass 'Delete dead loops' on basic block '<badref>'
 #0 0x00000000027d2723 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(../../master/llvm/build-all/bin/opt+0x27d2723)
 #1 0x00000000027d03ee llvm::sys::RunSignalHandlers()
(../../master/llvm/build-all/bin/opt+0x27d03ee)
 #2 0x00000000027d2bdc SignalHandler(int)
(../../master/llvm/build-all/bin/opt+0x27d2bdc)
 #3 0x00007f81189d78a0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
 #4 0x00007f8115ff9f47 raise
/build/glibc-2ORdQG/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007f8115ffb8b1 abort /build/glibc-2ORdQG/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00000000019a6ec6 llvm::ScalarEvolution::verify() const
(../../master/llvm/build-all/bin/opt+0x19a6ec6)
 #7 0x0000000002890beb llvm::deleteDeadLoop(llvm::Loop*, llvm::DominatorTree*,
llvm::ScalarEvolution*, llvm::LoopInfo*, llvm::MemorySSA*)
(../../master/llvm/build-all/bin/opt+0x2890beb)
 #8 0x000000000255f075 deleteLoopIfDead(llvm::Loop*, llvm::DominatorTree&,
llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::MemorySSA*,
llvm::OptimizationRemarkEmitter&)
(../../master/llvm/build-all/bin/opt+0x255f075)
 #9 0x000000000255f9a9 (anonymous
namespace)::LoopDeletionLegacyPass::runOnLoop(llvm::Loop*,
llvm::LPPassManager&) (../../master/llvm/build-all/bin/opt+0x255f9a9)
#10 0x00000000018e08db llvm::LPPassManager::runOnFunction(llvm::Function&)
(../../master/llvm/build-all/bin/opt+0x18e08db)
#11 0x000000000202274f llvm::FPPassManager::runOnFunction(llvm::Function&)
(../../master/llvm/build-all/bin/opt+0x202274f)
#12 0x0000000002028fe8 llvm::FPPassManager::runOnModule(llvm::Module&)
(../../master/llvm/build-all/bin/opt+0x2028fe8)
#13 0x0000000002022d1d llvm::legacy::PassManagerImpl::run(llvm::Module&)
(../../master/llvm/build-all/bin/opt+0x2022d1d)
#14 0x000000000075e5f1 main (../../master/llvm/build-all/bin/opt+0x75e5f1)
#15 0x00007f8115fdcb97 __libc_start_main
/build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
#16 0x000000000074589a _start (../../master/llvm/build-all/bin/opt+0x74589a)
Abort (core dumped)

This starts happening with commit 60b852092c9:
    [LoopDeletion] Forget loop before setting values to undef

    After D71539, we need to forget the loop before setting the incoming
    values of phi nodes in exit blocks, because we are looking through those
    phi nodes now and the SCEV expression could depend on the loop phi. If
    we update the phi nodes before forgetting the loop, we miss those users
    during invalidation.

    Reviewed By: reames

    Differential Revision: https://reviews.llvm.org/D88167

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201007/448cbb22/attachment.html>


More information about the llvm-bugs mailing list