Skip to content

Commit

Permalink
AsmPrinter: Remove pointless code in inline asm emission
Browse files Browse the repository at this point in the history
This was scanning through def operands looking for the
symbol operand. This is pointless because the symbol is always
the first operand as enforced by the verifier, and all operands
are implicit.
  • Loading branch information
arsenm committed Oct 14, 2022
1 parent d0269dd commit c427ee9
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
Expand Up @@ -330,16 +330,8 @@ static void EmitInlineAsmStr(const char *AsmStr, const MachineInstr *MI,
void AsmPrinter::emitInlineAsm(const MachineInstr *MI) const {
assert(MI->isInlineAsm() && "printInlineAsm only works on inline asms");

// Count the number of register definitions to find the asm string.
unsigned NumDefs = 0;
for (; MI->getOperand(NumDefs).isReg() && MI->getOperand(NumDefs).isDef();
++NumDefs)
assert(NumDefs != MI->getNumOperands()-2 && "No asm string?");

assert(MI->getOperand(NumDefs).isSymbol() && "No asm string?");

// Disassemble the AsmStr, printing out the literal pieces, the operands, etc.
const char *AsmStr = MI->getOperand(NumDefs).getSymbolName();
const char *AsmStr = MI->getOperand(0).getSymbolName();

// If this asmstr is empty, just print the #APP/#NOAPP markers.
// These are useful to see where empty asm's wound up.
Expand Down

0 comments on commit c427ee9

Please sign in to comment.