Issue 202263
Summary Assertion in RegisterCoalescer : `(TrackSubRegLiveness || V.RedefVNI) && "Instruction is reading nonexistent value"'
Labels new issue
Assignees
Reporter chrisj-quic
    The assertion in RegisterCoalescer is appearing after the commit https://github.com/llvm/llvm-project/pull/175598

Reproducer link: https://godbolt.org/z/n6f168avK

Below is a reduced test,

**Reduced test:**

```

target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "armv8a-unknown-linux-gnueabi"

define void @init(i64 %0, i1 %min.iters.check, ptr %1) {
entry:
  %2 = insertelement <2 x i64> poison, i64 %0, i64 1
  br i1 %min.iters.check, label %common.ret, label %vector.body

common.ret:
  ret void

vector.body:
  %3 = insertelement <2 x i64> %2, i64 1, i64 0
  store <2 x i64> %3, ptr %1, align 8
  br label %common.ret
}

```

**Command:**
```
llc test.ll
```

**Assertion:**
```
llc: /root/llvm-project/llvm/lib/CodeGen/RegisterCoalescer.cpp:2871: {anonymous}::JoinVals::ConflictResolution {anonymous}::JoinVals::analyzeValue(unsigned int, {anonymous}::JoinVals&): Assertion `(TrackSubRegLiveness || V.RedefVNI) && "Instruction is reading nonexistent value"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'Register Coalescer' on function '@init'
 #0 0x00000000043c5b98 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x43c5b98)
 #1 0x00000000043c29d4 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x43c29d4)
 #2 0x00000000043c2b4a SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x000075fc18645330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #4 0x000075fc1869eb2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
 #5 0x000075fc1864527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
 #6 0x000075fc186288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
 #7 0x000075fc1862881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
 #8 0x000075fc1863b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
 #9 0x00000000033cdc15 (anonymous namespace)::JoinVals::computeAssignment(unsigned int, (anonymous namespace)::JoinVals&) RegisterCoalescer.cpp:0:0
#10 0x00000000033cdce9 (anonymous namespace)::JoinVals::mapValues((anonymous namespace)::JoinVals&) RegisterCoalescer.cpp:0:0
#11 0x00000000033d375e (anonymous namespace)::RegisterCoalescer::joinVirtRegs(llvm::CoalescerPair&) RegisterCoalescer.cpp:0:0
#12 0x00000000033d9080 (anonymous namespace)::RegisterCoalescer::copyCoalesceWorkList(llvm::MutableArrayRef<llvm::MachineInstr*>) RegisterCoalescer.cpp:0:0
#13 0x00000000033db39d (anonymous namespace)::RegisterCoalescer::copyCoalesceInMBB(llvm::MachineBasicBlock*) RegisterCoalescer.cpp:0:0
#14 0x00000000033ddca7 (anonymous namespace)::RegisterCoalescer::run(llvm::MachineFunction&) RegisterCoalescer.cpp:0:0
#15 0x00000000033df05c (anonymous namespace)::RegisterCoalescerLegacy::runOnMachineFunction(llvm::MachineFunction&) RegisterCoalescer.cpp:0:0
#16 0x0000000003182449 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#17 0x00000000037ba31c llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x37ba31c)
#18 0x00000000037ba611 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x37ba611)
#19 0x00000000037baecd llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x37baecd)
#20 0x0000000000911970 compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
#21 0x00000000007d395c main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7d395c)
#22 0x000075fc1862a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#23 0x000075fc1862a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#24 0x00000000009066e5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x9066e5)
Program terminated with signal: SIGSEGV

```


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to