[llvm] r355325 - [MC] Teach ELFObjectWriter that parse-time variables do not appear in
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 4 11:12:56 PST 2019
Author: niravd
Date: Mon Mar 4 11:12:56 2019
New Revision: 355325
URL: http://llvm.org/viewvc/llvm-project?rev=355325&view=rev
Log:
[MC] Teach ELFObjectWriter that parse-time variables do not appear in
symbol table.
Added:
llvm/trunk/test/MC/X86/unused_reg_var_assign.s
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=355325&r1=355324&r2=355325&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Mon Mar 4 11:12:56 2019
@@ -577,6 +577,10 @@ bool ELFWriter::isInSymtab(const MCAsmLa
bool Used, bool Renamed) {
if (Symbol.isVariable()) {
const MCExpr *Expr = Symbol.getVariableValue();
+ // Target Expressions that are always inlined do not appear in the symtab
+ if (const auto *T = dyn_cast<MCTargetExpr>(Expr))
+ if (T->inlineAssignedExpr())
+ return false;
if (const MCSymbolRefExpr *Ref = dyn_cast<MCSymbolRefExpr>(Expr)) {
if (Ref->getKind() == MCSymbolRefExpr::VK_WEAKREF)
return false;
Added: llvm/trunk/test/MC/X86/unused_reg_var_assign.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/unused_reg_var_assign.s?rev=355325&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/unused_reg_var_assign.s (added)
+++ llvm/trunk/test/MC/X86/unused_reg_var_assign.s Mon Mar 4 11:12:56 2019
@@ -0,0 +1,3 @@
+# RUN: llvm-mc -triple x86_64-unknown-linux-gnu -filetype obj %s -o %t
+
+reg_i = %xmm0
More information about the llvm-commits
mailing list