Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RegCoalescer asserts during joinSubRanges #32035

Closed
arsenm opened this issue Apr 17, 2017 · 3 comments
Closed

RegCoalescer asserts during joinSubRanges #32035

arsenm opened this issue Apr 17, 2017 · 3 comments
Assignees
Labels
bugzilla regalloc

Comments

@arsenm
Copy link
Contributor

@arsenm arsenm commented Apr 17, 2017

Bugzilla Link 32688
Resolution FIXED
Resolved on May 18, 2017 17:29
Version trunk
OS Linux
Attachments testcase, Testcase, MIR testcase, Testcase, MIR testcase, MIR testcase, MIR testcase
CC @MatzeB

Extended Description

llc: ../lib/CodeGen/RegisterCoalescer.cpp:2212: JoinVals::ConflictResolution (anonymous namespace)::JoinVals::analyzeValue(unsigned int, (anonymous namespace)::JoinVals &): Assertion `DefMI != nullptr' failed.
#​0 0x0000000002c919b9 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/marsenau/src/lightning/llvm/build_debug/../lib/Support/Unix/Signals.inc:398:11
#​1 0x0000000002c91b69 PrintStackTraceSignalHandler(void*) /home/marsenau/src/lightning/llvm/build_debug/../lib/Support/Unix/Signals.inc:462:1
#​2 0x0000000002c90203 llvm::sys::RunSignalHandlers() /home/marsenau/src/lightning/llvm/build_debug/../lib/Support/Signals.cpp:44:5
#​3 0x0000000002c91ec4 SignalHandler(int) /home/marsenau/src/lightning/llvm/build_debug/../lib/Support/Unix/Signals.inc:252:1
#​4 0x00007f46a3d17390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#​5 0x00007f46a2882428 gsignal /build/glibc-9tT8Do/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#​6 0x00007f46a288402a abort /build/glibc-9tT8Do/glibc-2.23/stdlib/abort.c:91:0
#​7 0x00007f46a287abd7 __assert_fail_base /build/glibc-9tT8Do/glibc-2.23/assert/assert.c:92:0
#​8 0x00007f46a287ac82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#​9 0x00000000021f5575 (anonymous namespace)::JoinVals::analyzeValue(unsigned int, (anonymous namespace)::JoinVals&) /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/RegisterCoalescer.cpp:2213:9
#​10 0x00000000021f4a02 (anonymous namespace)::JoinVals::computeAssignment(unsigned int, (anonymous namespace)::JoinVals&) /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/RegisterCoalescer.cpp:2424:12
#​11 0x00000000021f1e59 (anonymous namespace)::JoinVals::mapValues((anonymous namespace)::JoinVals&) /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/RegisterCoalescer.cpp:2459:5
#​12 0x00000000021f7431 (anonymous namespace)::RegisterCoalescer::joinSubRegRanges(llvm::LiveRange&, llvm::LiveRange&, llvm::LaneBitmask, llvm::CoalescerPair const&) /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/RegisterCoalescer.cpp:2848:35
#​13 0x00000000021f7207 (anonymous namespace)::RegisterCoalescer::mergeSubRangeInto(llvm::LiveInterval&, llvm::LiveRange const&, llvm::LaneBitmask, llvm::CoalescerPair&)::$_2::operator()(llvm::LiveInterval::SubRange&) const /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/RegisterCoalescer.cpp:2908:7
#​14 0x00000000021f6fe2 std::_Function_handler<void (llvm::LiveInterval::SubRange&), (anonymous namespace)::RegisterCoalescer::mergeSubRangeInto(llvm::LiveInterval&, llvm::LiveRange const&, llvm::LaneBitmask, llvm::CoalescerPair&)::$_2>::_M_invoke(std::_Any_data const&, llvm::LiveInterval::SubRange&) /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/functional:1873:7
#​15 0x0000000002010e68 std::function<void (llvm::LiveInterval::SubRange&)>::operator()(llvm::LiveInterval::SubRange&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/functional:2267:7
#​16 0x000000000200baf3 llvm::LiveInterval::refineSubRanges(llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&, llvm::LaneBitmask, std::function<void (llvm::LiveInterval::SubRange&)>) /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/LiveInterval.cpp:887:5
#​17 0x00000000021f2afb (anonymous namespace)::RegisterCoalescer::mergeSubRangeInto(llvm::LiveInterval&, llvm::LiveRange const&, llvm::LaneBitmask, llvm::CoalescerPair&) /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/RegisterCoalescer.cpp:2901:3
#​18 0x00000000021f15ff (anonymous namespace)::RegisterCoalescer::joinVirtRegs(llvm::CoalescerPair&) /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/RegisterCoalescer.cpp:2965:5
#​19 0x00000000021ed430 (anonymous namespace)::RegisterCoalescer::joinIntervals(llvm::CoalescerPair&) /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/RegisterCoalescer.cpp:3026:50
#​20 0x00000000021ea848 (anonymous namespace)::RegisterCoalescer::joinCopy(llvm::MachineInstr*, bool&) /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/RegisterCoalescer.cpp:1622:7
#​21 0x00000000021e8a82 (anonymous namespace)::RegisterCoalescer::copyCoalesceWorkList(llvm::MutableArrayRefllvm::MachineInstr*) /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/RegisterCoalescer.cpp:3097:10
#​22 0x00000000021e8190 (anonymous namespace)::RegisterCoalescer::coalesceLocals() /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/RegisterCoalescer.cpp:3222:17
#​23 0x00000000021e7b6e (anonymous namespace)::RegisterCoalescer::joinAllIntervals() /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/RegisterCoalescer.cpp:3247:7
#​24 0x00000000021e725b (anonymous namespace)::RegisterCoalescer::runOnMachineFunction(llvm::MachineFunction&) /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/RegisterCoalescer.cpp:3302:18
#​25 0x00000000020a0561 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/marsenau/src/lightning/llvm/build_debug/../lib/CodeGen/MachineFunctionPass.cpp:62:8
#​26 0x00000000024c1e9f llvm::FPPassManager::runOnFunction(llvm::Function&) /home/marsenau/src/lightning/llvm/build_debug/../lib/IR/LegacyPassManager.cpp:1513:23
#​27 0x00000000024c21b5 llvm::FPPassManager::runOnModule(llvm::Module&) /home/marsenau/src/lightning/llvm/build_debug/../lib/IR/LegacyPassManager.cpp:1534:16
#​28 0x00000000024c294a (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/marsenau/src/lightning/llvm/build_debug/../lib/IR/LegacyPassManager.cpp:1590:23
#​29 0x00000000024c2476 llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/marsenau/src/lightning/llvm/build_debug/../lib/IR/LegacyPassManager.cpp:1693:16
#​30 0x00000000024c2e61 llvm::legacy::PassManager::run(llvm::Module&) /home/marsenau/src/lightning/llvm/build_debug/../lib/IR/LegacyPassManager.cpp:1724:3
#​31 0x0000000000a0b422 compileModule(char**, llvm::LLVMContext&) /home/marsenau/src/lightning/llvm/build_debug/../tools/llc/llc.cpp:579:42
#​32 0x0000000000a09784 main /home/marsenau/src/lightning/llvm/build_debug/../tools/llc/llc.cpp:331:13
#​33 0x00007f46a286d830 __libc_start_main /build/glibc-9tT8Do/glibc-2.23/csu/../csu/libc-start.c:325:0
#​34 0x0000000000a090a9 _start (/home/marsenau/src/lightning/llvm/build_debug/bin/llc+0xa090a9)
Stack dump:
0. Program arguments: /home/marsenau/src/lightning/llvm/build_debug/bin/llc -verify-machineinstrs -o - reg-coalescer-crash.ll

  1. Running pass 'Function Pass Manager' on module 'reg-coalescer-crash.ll'.
  2. Running pass 'Simple Register Coalescing' on function '@defmi_null_assert'
@arsenm
Copy link
Contributor Author

@arsenm arsenm commented Apr 17, 2017

assigned to @MatzeB

@MatzeB
Copy link
Contributor

@MatzeB MatzeB commented May 18, 2017

This fixes the given testcase for me:

--- a/lib/CodeGen/RegisterCoalescer.cpp
+++ b/lib/CodeGen/RegisterCoalescer.cpp
@@ -2666,7 +2666,8 @@ void JoinVals::pruneSubRegValues(LiveInterval &LI, LaneBitmask &ShrinkMask) {
// Look for values being erased.
bool DidPrune = false;
for (unsigned i = 0, e = LR.getNumValNums(); i != e; ++i) {

  • if (Vals[i].Resolution != CR_Erase)
  • if (Vals[i].Resolution != CR_Erase &&

  •    (Vals[i].Resolution != CR_Keep || !Vals[i].ErasableImplicitDef))
     continue;
    

    // Check subranges at the point where the copy will be removed.

But I have to think and test some more...

@MatzeB
Copy link
Contributor

@MatzeB MatzeB commented May 19, 2017

Thanks for the report and esp. the nicely reduced testcase. Fixed in r303396

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla regalloc
Projects
None yet
Development

No branches or pull requests

2 participants