[PATCH] D65304: [MC] Don't recreate a label if it's already used
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 8 09:39:05 PDT 2019
nickdesaulniers added inline comments.
================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp:435
Sym->print(OS, AP->MAI);
+ MMI->getContext().registerInlineAsmLabel(Sym->getName(), Sym);
} else if (MI->getOperand(OpNo).isMBB()) {
----------------
Seeing repeated references to a the same variable in a parameter list (`Sym`) is a code smell. So `registerInlineAsmLabel` could just take a `MCSymbol*` and pull the name out of it via `getName()`.
================
Comment at: test/CodeGen/AArch64/callbr-asm-label.ll:1
+; RUN: llc < %s -mtriple=armv4t-unknown-linux-gnueabi | FileCheck %s
+
----------------
the triple for AArch64 should be `aarch64-linux-gnu` (armv4t is 32b ARM).
================
Comment at: test/CodeGen/X86/callbr-asm-label-addr.ll:8
+; CHECK-LABEL: .Ltmp1:
+; CHECK-LABEL: .LBB0_1: # %bar
+; CHECK-NEXT: callq foo
----------------
Maybe not necessary to solve in this patch, but it's curious to me why we emit BOTH `.Ltmp1` AND `.LBB0_1` for `%bar`, but only `.Ltmp0` for `%baz` (with `%bb.2` commented out). Obviously related to `%bar` being the `callbr` jump target (while `%baz` is simply the address of a label), but something seems wrong to me to emit so many labels to the same statement.
>From this case specifically, I feel like `.LBB0_1:` should not be emitted, and instead there should be a (commented out) `# %bb.1: # %bar`.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65304/new/
https://reviews.llvm.org/D65304
More information about the llvm-commits
mailing list