When folding a COPY of exec into another COPY, the call to
TII->isOperandLegal would crash because COPYs don't have defined
register classes for their operands.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp | ||
---|---|---|
425 | I was wondering about that. How do all the existing callers of isOperandLegal manage not to hit this assertion? llc: lib/Target/AMDGPU/SIInstrInfo.cpp:5013: bool llvm::SIInstrInfo::isOperandLegal(const llvm::MachineInstr &, unsigned int, const llvm::MachineOperand *) const: Assertion `DefinedRC' failed. |
llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp | ||
---|---|---|
425 | In fact, the operand always legal in COPY. So, SIInstrInfo::isOperandLegal may just return true for the case where no defined RC and the instruction opcode is COPY |
LGTM if we do not want to change the COPY processing in the SIInstrInfo::isOperandLegal
How about this? As @arsenm pointed out this can happen for other instructions, not just COPY, so I handle them all the same way.
A COPY isn't the only case where this happens though