[llvm] [SPIRV] Return success when selecting reads and writes. (PR #122162)
Vyacheslav Levytskyy via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 13 03:24:37 PST 2025
================
@@ -3108,12 +3111,16 @@ void SPIRVInstructionSelector::extractSubvector(
const TargetRegisterClass *ScalarRegClass = GR.getRegClass(ScalarType);
for (uint64_t I = 0; I < ResultSize; I++) {
Register ComponentReg = MRI->createVirtualRegister(ScalarRegClass);
- BuildMI(*InsertionPoint.getParent(), InsertionPoint,
- InsertionPoint.getDebugLoc(), TII.get(SPIRV::OpCompositeExtract))
- .addDef(ComponentReg)
- .addUse(ScalarType->getOperand(0).getReg())
- .addUse(ReadReg)
- .addImm(I);
+ bool Succeed = BuildMI(*InsertionPoint.getParent(), InsertionPoint,
+ InsertionPoint.getDebugLoc(),
+ TII.get(SPIRV::OpCompositeExtract))
+ .addDef(ComponentReg)
+ .addUse(ScalarType->getOperand(0).getReg())
+ .addUse(ReadReg)
+ .addImm(I)
+ .constrainAllUses(TII, TRI, RBI);
+ if (!Succeed)
+ return false;
ComponentRegisters.emplace_back(ComponentReg);
}
----------------
VyacheslavLevytskyy wrote:
We need to add `return true;` here.
https://github.com/llvm/llvm-project/pull/122162
More information about the llvm-commits
mailing list