[llvm-bugs] [Bug 49510] New: opt crashes with Assertion `HT.TopLevelMap[ThisEntry->getKey()] == ThisEntry && "Scope imbalance!"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 10 05:31:54 PST 2021


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

            Bug ID: 49510
           Summary: opt crashes with Assertion
                    `HT.TopLevelMap[ThisEntry->getKey()] == ThisEntry &&
                    "Scope imbalance!"' failed.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org

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

Running
 opt -bonus-inst-threshold=2 -o /dev/null bbi-53820.ll -simplifycfg
-early-cse-memssa

results in 

opt: ../include/llvm/ADT/ScopedHashTable.h:245:
llvm::ScopedHashTableScope<(anonymous namespace)::SimpleValue, llvm::Value *,
llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>,
llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,
4096, 4096, 128>, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue,
llvm::Value *>, 32, 8> >::~ScopedHashTableScope() [K = (anonymous
namespace)::SimpleValue, V = llvm::Value *, KInfo =
llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>, AllocatorTy =
llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,
4096, 4096, 128>, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue,
llvm::Value *>, 32, 8>]: Assertion `HT.TopLevelMap[ThisEntry->getKey()] ==
ThisEntry && "Scope imbalance!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0.      Program arguments: build-all/bin/opt -bonus-inst-threshold=2 -o
/dev/null bbi-53820.ll -simplifycfg -early-cse-memssa
1.      Running pass 'Function Pass Manager' on module 'bbi-53820.ll'.
2.      Running pass 'Early CSE w/ MemorySSA' on function '@f'
 #0 0x0000000002957893 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(build-all/bin/opt+0x2957893)
 #1 0x000000000295554e llvm::sys::RunSignalHandlers()
(build-all/bin/opt+0x295554e)
 #2 0x0000000002957d56 SignalHandler(int) (build-all/bin/opt+0x2957d56)
 #3 0x00007f83bf6ed630 __restore_rt (/lib64/libpthread.so.0+0xf630)
 #4 0x00007f83bce20387 raise (/lib64/libc.so.6+0x36387)
 #5 0x00007f83bce21a78 abort (/lib64/libc.so.6+0x37a78)
 #6 0x00007f83bce191a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
 #7 0x00007f83bce19252 (/lib64/libc.so.6+0x2f252)
 #8 0x000000000264784b (anonymous namespace)::EarlyCSE::run()
(build-all/bin/opt+0x264784b)
 #9 0x00000000026509ee (anonymous
namespace)::EarlyCSELegacyCommonPass<true>::runOnFunction(llvm::Function&)
(build-all/bin/opt+0x26509ee)
#10 0x0000000002153e8f llvm::FPPassManager::runOnFunction(llvm::Function&)
(build-all/bin/opt+0x2153e8f)
#11 0x000000000215a7e8 llvm::FPPassManager::runOnModule(llvm::Module&)
(build-all/bin/opt+0x215a7e8)
#12 0x000000000215445d llvm::legacy::PassManagerImpl::run(llvm::Module&)
(build-all/bin/opt+0x215445d)
#13 0x000000000077ae0c main (build-all/bin/opt+0x77ae0c)
#14 0x00007f83bce0c555 __libc_start_main (/lib64/libc.so.6+0x22555)
#15 0x0000000000765d85 _start (build-all/bin/opt+0x765d85)
Abort

This starts happening with 1742203844:

    [SimplifyCFG] FoldBranchToCommonDest(): re-lift restrictions on liveout
uses of bonus instructions

    I have previously tried doing that in
    b33fbbaa34f0fe9fb16789afc72ae424c1825b69 /
d38205144febf4dc42c9270c6aa3d978f1ef65e1,
    but eventually it was pointed out that the approach taken there
    was just broken wrt how the uses of bonus instructions are updated
    to account for the fact that they should now use either bonus instruction
    or the cloned bonus instruction. In particluar, all that manual handling
    of PHI nodes in successors was just wrong.

    But, the fix is actually much much simpler than my initial approach:
    just tell SSAUpdate about both instances of bonus instruction,
    and let it deal with all the PHI handling.

    Alive2 confirms that the reproducers from the original bugs (@pr48450*)
    are now handled correctly.

    This effectively reverts commit 59560e85897afc50090b6c3d920bacfd28b49d06,
    effectively relanding b33fbbaa34f0fe9fb16789afc72ae424c1825b69.

-- 
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/20210310/bb75d046/attachment-0001.html>


More information about the llvm-bugs mailing list