[llvm] c427ee9 - AsmPrinter: Remove pointless code in inline asm emission

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 13 21:12:21 PDT 2022


Author: Matt Arsenault
Date: 2022-10-13T21:12:11-07:00
New Revision: c427ee979898598c41c7d5ab81835da3043d3aa4

URL: https://github.com/llvm/llvm-project/commit/c427ee979898598c41c7d5ab81835da3043d3aa4
DIFF: https://github.com/llvm/llvm-project/commit/c427ee979898598c41c7d5ab81835da3043d3aa4.diff

LOG: 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.

Added: 
    

Modified: 
    llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
index 842948008f59d..617ec13b79745 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -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.


        


More information about the llvm-commits mailing list