Issue 71023
Summary [RegisterCoalescer] Assertion `ReadI->valno == Seg.valno && "Cannot overlap different values"'
Labels llvm:codegen
Assignees
Reporter BeMg
    When RegisterCoalescer try to merge the following VReg

- `%12 [32r,80r:0)[96r,240r:2) 0@32r 1@80r 2@96r`
- `%17 [240e,288r:1) 0@48r 1@240e`

will trigger assertion inside LiveInterval.cpp. 

```
llc: /llvm/lib/CodeGen/LiveInterval.cpp:1218: void llvm::LiveRangeUpdater::add(llvm::LiveRange::Segment): Assertion `ReadI->valno == Seg.valno && "Cannot overlap different values"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /build/bin/llc reduced_ec.mir -run-pass=register-coalescer -debug
1.	Running pass 'Function Pass Manager' on module 'reduced_ec.mir'.
2.	Running pass 'Register Coalescer' on function '@main'
 #0 0x00000000030c5de8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/build/bin/llc+0x30c5de8)
 #1 0x00000000030c350c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f7513bbfcf0 __restore_rt (/lib64/libpthread.so.0+0x12cf0)
 #3 0x00007f75126b5aff raise (/lib64/libc.so.6+0x4eaff)
 #4 0x00007f7512688ea5 abort (/lib64/libc.so.6+0x21ea5)
 #5 0x00007f7512688d79 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21d79)
 #6 0x00007f75126ae456 (/lib64/libc.so.6+0x47456)
 #7 0x000000000239a466 llvm::LiveRangeUpdater::add(llvm::LiveRange::Segment) (/build/bin/llc+0x239a466)
 #8 0x000000000239a949 llvm::LiveRange::join(llvm::LiveRange&, int const*, int const*, llvm::SmallVectorImpl<llvm::VNInfo*>&) (/build/bin/llc+0x239a949)
 #9 0x000000000264148f (anonymous namespace)::RegisterCoalescer::joinCopy(llvm::MachineInstr*, bool&) (.constprop.660) RegisterCoalescer.cpp:0:0
#10 0x000000000264212f (anonymous namespace)::RegisterCoalescer::copyCoalesceWorkList(llvm::MutableArrayRef<llvm::MachineInstr*>) RegisterCoalescer.cpp:0:0
#11 0x000000000264221d (anonymous namespace)::RegisterCoalescer::coalesceLocals() RegisterCoalescer.cpp:0:0
#12 0x00000000026450dc (anonymous namespace)::RegisterCoalescer::runOnMachineFunction(llvm::MachineFunction&) RegisterCoalescer.cpp:0:0
#13 0x000000000245c50a llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.77) MachineFunctionPass.cpp:0:0
#14 0x00000000029718ae llvm::FPPassManager::runOnFunction(llvm::Function&) (/build/bin/llc+0x29718ae)
#15 0x0000000002971ad9 llvm::FPPassManager::runOnModule(llvm::Module&) (/build/bin/llc+0x2971ad9)
#16 0x0000000002972675 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/build/bin/llc+0x2972675)
#17 0x0000000000491ce1 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#18 0x00000000004929c3 main (/build/bin/llc+0x4929c3)
#19 0x00007f75126a1d85 __libc_start_main (/lib64/libc.so.6+0x3ad85)
#20 0x00000000004870ae _start (/build/bin/llc+0x4870ae)

```


```
# RUN: llc  %s -o - -mtriple=riscv64 -mattr=+v -run-pass=register-coalescer \
# RUN: -verify-machineinstrs | FileCheck %s

---
name: main
tracksRegLiveness: true
body:             |
  bb.0:
 successors: %bb.5(0x40000000), %bb.3(0x40000000)
    liveins: $x10, $v8, $v10

    %32:gpr = IMPLICIT_DEF
    %10:vrnov0 = PseudoVMV_V_I_M1 undef %10, 0, -1, 3 /* e8 */, 0 /* tu, mu */, implicit $vl, implicit $vtype
    %11:vrnov0 = IMPLICIT_DEF
    undef %12.sub_vrm1_0:vrn6m1nov0 = COPY undef %10
    %12.sub_vrm1_3:vrn6m1nov0 = COPY %11
    %12.sub_vrm1_4:vrn6m1nov0 = COPY undef %10
    BNE undef %32, $x0, %bb.5
    PseudoBR %bb.3

  bb.3:
    successors: %bb.5(0x40000000), %bb.4(0x40000000)

    BNE killed undef %32, $x0, %bb.5
    PseudoBR %bb.4

  bb.4:
    successors: %bb.5(0x80000000)

  bb.5:
    %1:vr = IMPLICIT_DEF
 early-clobber %1:vr = PseudoVRGATHER_VI_M1 undef %1, killed %10, 0, 0, 3 /* e8 */, 0 /* tu, mu */, implicit $vl, implicit $vtype
    undef %17.sub_vrm1_0:vrn6m1 = COPY killed %1
    %17.sub_vrm1_5:vrn6m1 = COPY killed %11
    PseudoVSSEG6E8_V_M1_MASK killed %17, undef %32, killed undef $v0, 0, 3 /* e8 */, implicit $vl, implicit $vtype :: (store unknown-size, align 1)
    PseudoRET
...
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to