[llvm] [CodeGen] Utilizing register units based liveIns tracking in MBB (PR #129847)

Vikash Gupta via llvm-commits llvm-commits at lists.llvm.org
Thu May 1 23:46:15 PDT 2025


vg0204 wrote:

Made the necessary changes in MBB-liveins and their use-sites repectively. 

About 2,3k LIT tests are failing all across the archs, out of which about 200 are failing with exit code-2. When looked into those, found that all failing with varieties of **Bad machine code**. Most of these have almost similar stack strace as follows :

```
#7 0x0000564a3883223f llvm::MachineFunction::verify(llvm::Pass*, char const*, llvm::raw_ostream*, bool) const (/home/vikashgu/work/upstream/llvm-project/build-release/bin/llc+0x32cf23f)
 #8 0x0000564a3862f59b llvm::LiveRangeCalc::findReachingDefs(llvm::LiveRange&, llvm::MachineBasicBlock&, llvm::SlotIndex, unsigned int, llvm::ArrayRef<llvm::SlotIndex>) (/home/vikashgu/work/upstream/llvm-project/build-release/bin/llc+0x30cc59b)
 #9 0x0000564a38630c06 llvm::LiveRangeCalc::extend(llvm::LiveRange&, llvm::SlotIndex, unsigned int, llvm::ArrayRef<llvm::SlotIndex>) (/home/vikashgu/work/upstream/llvm-project/build-release/bin/llc+0x30cdc06)
#10 0x0000564a386314bd llvm::LiveIntervalCalc::extendToUses(llvm::LiveRange&, llvm::Register, llvm::LaneBitmask, llvm::LiveInterval*) (/home/vikashgu/work/upstream/llvm-project/build-release/bin/llc+0x30ce4bd)
#11 0x0000564a38611791 llvm::LiveIntervals::computeRegUnitRange(llvm::LiveRange&, unsigned int) (/home/vikashgu/work/upstream/llvm-project/build-release/bin/llc+0x30ae791)
#12 0x0000564a38636f38 bool foreachUnit<llvm::LiveRegMatrix::checkRegUnitInterference(llvm::LiveInterval const&, llvm::MCRegister)::'lambda'(unsigned int, llvm::LiveRange const&)>(llvm::TargetRegisterInfo const*, llvm::LiveInterval const&, llvm::MCRegister, llvm::LiveRegMatrix::checkRegUnitInterference(llvm::LiveInterval const&, llvm::MCRegister)::'lambda'(unsigned int, llvm::LiveRange const&)) LiveRegMatrix.cpp:0:0
#13 0x0000564a38638cbf llvm::LiveRegMatrix::checkInterference(llvm::LiveInterval const&, llvm::MCRegister) (/home/vikashgu/work/upstream/llvm-project/build-release/bin/llc+0x30d5cbf)
#14 0x0000564a3891a415 llvm::RAGreedy::tryAssign(llvm::LiveInterval const&, llvm::AllocationOrder&, llvm::SmallVectorImpl<llvm::Register>&, llvm::SmallSet<llvm::Register, 16u, std::less<llvm::Register>> const&) (/home/vikashgu/work/upstream/llvm-project/build-release/bin/llc+0x33b7415)
#15 0x0000564a3891c792 llvm::RAGreedy::selectOrSplitImpl(llvm::LiveInterval const&, llvm::SmallVectorImpl<llvm::Register>&, llvm::SmallSet<llvm::Register, 16u, std::less<llvm::Register>>&, llvm::SmallVector<std::pair<llvm::LiveInterval const*, llvm::MCRegister>, 8u>&, unsigned int) (/home/vikashgu/work/upstream/llvm-project/build-release/bin/llc+0x33b9792)
#16 0x0000564a3891d74e llvm::RAGreedy::selectOrSplit(llvm::LiveInterval const&, llvm::SmallVectorImpl<llvm::Register>&) (/home/vikashgu/work/upstream/llvm-project/build-release/bin/llc+0x33ba74e)
#17 0x0000564a38b84564 llvm::RegAllocBase::allocatePhysRegs() (/home/vikashgu/work/upstream/llvm-project/build-release/bin/llc+0x3621564)
#18 0x0000564a38918fab llvm::RAGreedy::run(llvm::MachineFunction&) (/home/vikashgu/work/upstream/llvm-project/build-release/bin/llc+0x33b5fab)
#19 0x0000564a38919c83 (anonymous namespace)::RAGreedyLegacy::runOnMachineFunction(llvm::MachineFunction&) RegAllocGreedy.cpp:0:0
#20 0x0000564a386f6a52 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#21 0x0000564a38d394e7 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/vikashgu/work/upstream/llvm-project/build-release/bin/llc+0x37d64e7)
#22 0x0000564a38d398a9 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/vikashgu/work/upstream/llvm-project/build-release/bin/llc+0x37d68a9)
#23 0x0000564a38d3a1b1 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/vikashgu/work/upstream/llvm-project/build-release/bin/llc+0x37d71b1)
#24 0x0000564a361b8953 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
```

And for all these test, the stack trace becomes exactly same from `computeRegUnitRange` call.  Also, this all belongs to VE target as well! Currently looking into it

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


More information about the llvm-commits mailing list