[MC] Don't recreate a label if it's already used
authorBill Wendling <isanbard@gmail.com>
Fri, 9 Aug 2019 20:16:31 +0000 (20:16 +0000)
committerBill Wendling <isanbard@gmail.com>
Fri, 9 Aug 2019 20:16:31 +0000 (20:16 +0000)
commit1b104388752f66191c867380efde7bbf1f13ca80
treeb3b661c721628693c0dd27a2d58a9997f7274096
parent8e2842cc859b0557e14955b78abe214bc1a0c3b0
[MC] Don't recreate a label if it's already used

Summary:
This patch keeps track of MCSymbols created for blocks that were
referenced in inline asm. It prevents creating a new symbol which
doesn't refer to the block.

Inline asm may have a reference to a label. The asm parser however
doesn't recognize it as a label and tries to create a new symbol. The
result being that instead of the original symbol (e.g. ".Ltmp0") the
parser replaces it in the inline asm with the new one (e.g. ".Ltmp00")
without updating it in the symbol table. So the machine basic block
retains the "old" symbol (".Ltmp0"), but the inline asm uses the new one
(".Ltmp00").

Reviewers: nickdesaulniers, craig.topper

Subscribers: nathanchance, javed.absar, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D65304

llvm-svn: 368477
llvm/include/llvm/MC/MCContext.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
llvm/lib/MC/MCContext.cpp
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/test/CodeGen/AArch64/callbr-asm-label.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/callbr-asm-label-addr.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/callbr-asm.ll