Skip to content

Commit c427ee9

Browse files
committed
AsmPrinter: Remove pointless code in inline asm emission
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.
1 parent d0269dd commit c427ee9

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -330,16 +330,8 @@ static void EmitInlineAsmStr(const char *AsmStr, const MachineInstr *MI,
330330
void AsmPrinter::emitInlineAsm(const MachineInstr *MI) const {
331331
assert(MI->isInlineAsm() && "printInlineAsm only works on inline asms");
332332

333-
// Count the number of register definitions to find the asm string.
334-
unsigned NumDefs = 0;
335-
for (; MI->getOperand(NumDefs).isReg() && MI->getOperand(NumDefs).isDef();
336-
++NumDefs)
337-
assert(NumDefs != MI->getNumOperands()-2 && "No asm string?");
338-
339-
assert(MI->getOperand(NumDefs).isSymbol() && "No asm string?");
340-
341333
// Disassemble the AsmStr, printing out the literal pieces, the operands, etc.
342-
const char *AsmStr = MI->getOperand(NumDefs).getSymbolName();
334+
const char *AsmStr = MI->getOperand(0).getSymbolName();
343335

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

0 commit comments

Comments
 (0)