[PATCH] D64888: Use the MachineBasicBlock symbol for a callbr target

Bill Wendling via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 14:46:08 PDT 2019


void created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Inline asm doesn't use labels when compiled as an object file. Therefore, we
shouldn't create one for the (potential) callbr destination. Instead, use the
symbol for the MachineBasicBlock.


Repository:
  rL LLVM

https://reviews.llvm.org/D64888

Files:
  lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp


Index: lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -430,8 +430,13 @@
           if (Modifier[0] == 'l') { // Labels are target independent.
             if (MI->getOperand(OpNo).isBlockAddress()) {
               const BlockAddress *BA = MI->getOperand(OpNo).getBlockAddress();
-              MCSymbol *Sym = AP->GetBlockAddressSymbol(BA);
-              Sym->print(OS, AP->MAI);
+              const Value *BB = BA->getOperand(1);
+              const MachineFunction *MF = MI->getParent()->getParent();
+              for (auto I = MF->begin(), E = MF->end(); I != E; ++I)
+                if (BB == I->getBasicBlock()) {
+                  I->getSymbol()->print(OS, AP->MAI);
+                  break;
+                }
             } else if (MI->getOperand(OpNo).isMBB()) {
               const MCSymbol *Sym = MI->getOperand(OpNo).getMBB()->getSymbol();
               Sym->print(OS, AP->MAI);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64888.210430.patch
Type: text/x-patch
Size: 1077 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190717/033d7987/attachment.bin>


More information about the llvm-commits mailing list