Closed
Description
The following Opcodes do not have AMDGPU::EXEC
mask as an implicit operand in their MC Instr Desc:
GLOBAL_STORE_DWORD_vi
BUFFER_LOAD_DWORD_OFFEN_vi
GLOBAL_STORE_DWORD_SADDR_vi
The issue appears when constructing a llvm::MachineInstr
from a valid llvm::MCInst
, in the same manner as llvm-exegesis here:
llvm-project/llvm/tools/llvm-exegesis/lib/Assembler.cpp
Lines 157 to 176 in 859de94
For the MIR to be correct, simply adding the explicit operands should be enough, as the implicit operands are automatically added according to the MCInstrDesc when calling the
llvm::BuildMI
here:This method will call the
llvm::MachineInstr
constructor with NoImplicit
flag set to false
:
llvm-project/llvm/lib/CodeGen/MachineInstr.cpp
Lines 98 to 114 in 859de94
However, when printing the constructed MIR, the implicit exec is nowhere to be seen:
GLOBAL_STORE_DWORD_vi $vgpr0_vgpr1, $vgpr2, 0, 0
BUFFER_LOAD_DWORD_OFFEN_vi $vgpr3, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 60, 0, 0
BUFFER_STORE_DWORD_OFFEN_vi $vgpr1, $vgpr3, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 84, 0, 0
This causes issues when these instructions get verified before running CodeGen passes.