From ccbffefccaff42b0d094c9ef0f49fc3e8c8456ea Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Fri, 19 Jul 2019 01:10:28 +0000 Subject: Use the MachineBasicBlock symbol for a callbr target Summary: 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. Reviewers: nickdesaulniers, craig.topper Reviewed By: nickdesaulniers Subscribers: xbolva00, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64888 llvm-svn: 366523 --- llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp') diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index 7721e996aca..59d3b7c8e55 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -430,8 +430,13 @@ static void EmitGCCInlineAsmStr(const char *AsmStr, const MachineInstr *MI, 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 BasicBlock *BB = BA->getBasicBlock(); + const MachineFunction *MF = MI->getParent()->getParent(); + for (const MachineBasicBlock &MBB : *MF) + if (BB == MBB.getBasicBlock()) { + MBB.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); -- cgit v1.2.3