[PATCH] D122737: [AMDGPU] Fix crash in SIOptimizeExecMaskingPreRA

Alexander via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 1 11:02:20 PDT 2022


alex-t added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp:425
             !SingleExecUser->getOperand(Idx).isImplicit() &&
-            TII->isOperandLegal(*SingleExecUser, Idx, &I->getOperand(1))) {
+            (SingleExecUser->isCopy() ||
+             TII->isOperandLegal(*SingleExecUser, Idx, &I->getOperand(1)))) {
----------------
foad wrote:
> arsenm wrote:
> > A COPY isn't the only case where this happens though
> 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.
> ```
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


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122737/new/

https://reviews.llvm.org/D122737



More information about the llvm-commits mailing list