From 79cb3ba08f8022ad1bb664bb0d0cd3cfe5111001 Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Wed, 21 Apr 2021 17:38:32 +0100 Subject: [PATCH] [AMDGPU] SIWholeQuadMode: don't add duplicate implicit $exec operands STRICT_WWM and STRICT_WQM are already defined with Uses = [EXEC], so there is no need to add another implicit use of $exec when lowering them to V_MOV_B32 instructions. Differential Revision: https://reviews.llvm.org/D100969 --- llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp b/llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp index ac9a504520e7..51a019bb9d2a 100644 --- a/llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp +++ b/llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp @@ -1436,8 +1436,11 @@ void SIWholeQuadMode::lowerCopyInstrs() { const unsigned MovOp = TII->getMovOpcode(regClass); MI->setDesc(TII->get(MovOp)); - // And make it implicitly depend on exec (like all VALU movs should do). - MI->addOperand(MachineOperand::CreateReg(AMDGPU::EXEC, false, true)); + // Check that it already implicitly depends on exec (like all VALU movs + // should do). + assert(any_of(MI->implicit_operands(), [](const MachineOperand &MO) { + return MO.isUse() && MO.getReg() == AMDGPU::EXEC; + })); } else { // Remove early-clobber and exec dependency from simple SGPR copies. // This allows some to be eliminated during/post RA.