[llvm] [RISCV64] liveness analysis (PR #167454)

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 4 07:49:38 PST 2025


asb wrote:

I can't promise this represents all the failures, but this is the first one I tried.

```llvm
; ModuleID = 'reduced.ll'
source_filename = "reduced.ll"
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "riscv64-unknown-linux-gnu"

define i1 @widget() personality ptr null {
bb:
  invoke void (ptr, ptr, ...) @baz(ptr null, ptr null, ptr null)
          to label %bb1 unwind label %bb2

bb1:                                              ; preds = %bb
  unreachable

bb2:                                              ; preds = %bb
  %landingpad = landingpad { ptr, i32 }
          cleanup
  resume { ptr, i32 } zeroinitializer
}

declare void @baz(ptr, ptr, ...)

```

Then run:
```
./tc.trial/bin/llc -mtriple=riscv64 -mattr=+rva22u64 -riscv-enable-live-variables < reduced2.ll 
	.attribute	4, 16
	.attribute	5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_b1p0_zic64b1p0_zicbom1p0_zicbop1p0_zicboz1p0_ziccamoa1p0_ziccif1p0_zicclsm1p0_ziccrse1p0_zicntr2p0_zicsr2p0_zihintpause2p0_zihpm2p0_zmmul1p0_za64rs1p0_zaamo1p0_zalrsc1p0_zfhmin1p0_zca1p0_zcd1p0_zba1p0_zbb1p0_zbs1p0_zkt1p0"
	.file	"reduced.ll"
Computed live-in set is inconsistent with MBB.
UNREACHABLE executed at ../../llvm/lib/Target/RISCV/RISCVLiveVariables.cpp:443!
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: ./tc.trial/bin/llc -mtriple=riscv64 -mattr=+rva22u64 -riscv-enable-live-variables
1.	Running pass 'Function Pass Manager' on module '<stdin>'.
2.	Running pass 'RISC-V Live Variable Analysis' on function '@widget'
 #0 0x00005b3eb5d4e506 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./tc.trial/bin/llc+0x3fe4506)
 #1 0x00005b3eb5d4ba35 llvm::sys::RunSignalHandlers() (./tc.trial/bin/llc+0x3fe1a35)
 #2 0x00005b3eb5d4f314 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007a237163e4d0 (/usr/lib/libc.so.6+0x3e4d0)
 #4 0x00007a237169890c (/usr/lib/libc.so.6+0x9890c)
 #5 0x00007a237163e3a0 raise (/usr/lib/libc.so.6+0x3e3a0)
 #6 0x00007a237162557a abort (/usr/lib/libc.so.6+0x2557a)
 #7 0x00005b3eb5cab59f (./tc.trial/bin/llc+0x3f4159f)
 #8 0x00005b3eb457bbb9 (anonymous namespace)::RISCVLiveVariables::runOnMachineFunction(llvm::MachineFunction&) RISCVLiveVariables.cpp:0:0
 #9 0x00005b3eb4c71723 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (./tc.trial/bin/llc+0x2f07723)
#10 0x00005b3eb5242c89 llvm::FPPassManager::runOnFunction(llvm::Function&) (./tc.trial/bin/llc+0x34d8c89)
#11 0x00005b3eb524aeb2 llvm::FPPassManager::runOnModule(llvm::Module&) (./tc.trial/bin/llc+0x34e0eb2)
#12 0x00005b3eb5243757 llvm::legacy::PassManagerImpl::run(llvm::Module&) (./tc.trial/bin/llc+0x34d9757)
#13 0x00005b3eb4084726 compileModule(char**, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
#14 0x00005b3eb4081c93 main (./tc.trial/bin/llc+0x2317c93)
#15 0x00007a2371627635 (/usr/lib/libc.so.6+0x27635)
#16 0x00007a23716276e9 __libc_start_main (/usr/lib/libc.so.6+0x276e9)
#17 0x00005b3eb407d6e5 _start (./tc.trial/bin/llc+0x23136e5)
Aborted                    (core dumped) ./tc.trial/bin/llc -mtriple=riscv64 -mattr=+rva22u64 -riscv-enable-live-variables < reduced2.ll
```

https://github.com/llvm/llvm-project/pull/167454


More information about the llvm-commits mailing list