MachineInstr* MI = /* some machine instruction */; MachineOperand& Op = MI->getOperand(1); if (Op.isDead()) { // Remove the operand from the instruction. MI->RemoveOperand(1); }
for (MachineOperand& Op : Uses) { if (Op.isDead()) { // Don't consider this operand. continue; } // Do something with Op. }This example iterates through a list of machine operands and skips any that are marked as dead. The MachineOperand class is part of LLVM's C++ API. It's included in the LLVM Core library.