-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
Labels
Description
There are some test failures in pull request #98632 when LiveIntervals
analysis happens before TwoAddressInstructionPass
, because SIInstrInfo::convertToThreeAddress
doesn't handle live intervals after folding immediate values:
llvm-project/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
Lines 3949 to 3961 in ae63db7
const auto killDef = [&]() -> void { | |
const MachineRegisterInfo &MRI = MBB.getParent()->getRegInfo(); | |
// The only user is the instruction which will be killed. | |
Register DefReg = DefMI->getOperand(0).getReg(); | |
if (!MRI.hasOneNonDBGUse(DefReg)) | |
return; | |
// We cannot just remove the DefMI here, calling pass will crash. | |
DefMI->setDesc(get(AMDGPU::IMPLICIT_DEF)); | |
for (unsigned I = DefMI->getNumOperands() - 1; I != 0; --I) | |
DefMI->removeOperand(I); | |
if (LV) | |
LV->getVarInfo(DefReg).AliveBlocks.clear(); | |
}; |
The live interval of
DefReg
is no longer valid.
In #66775, -early-live-intervals
will not work when using -run-pass
, the Liveintervals LIS
in TwoAddressInstructionPass
is nullptr
when I debugging this part. A possible way to test -early-live-intervals
is using:
llc -march=amdgcn -mcpu=gfx1010 %s -run-pass liveintervals -run-pass twoaddressinstruction -verify-machineinstrs -o -
but llc
will crash.