[PATCH] D52188: [MC] Avoid inlining constant symbols with variants.

Nirav Dave via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 17 13:35:53 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL342412: [MC] Avoid inlining constant symbols with variants. (authored by niravd, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D52188?vs=165812&id=165822#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52188

Files:
  llvm/trunk/lib/MC/MCParser/AsmParser.cpp
  llvm/trunk/test/MC/PowerPC/pr38945.s


Index: llvm/trunk/test/MC/PowerPC/pr38945.s
===================================================================
--- llvm/trunk/test/MC/PowerPC/pr38945.s
+++ llvm/trunk/test/MC/PowerPC/pr38945.s
@@ -0,0 +1,21 @@
+// RUN: llvm-mc -triple=powerpc64-pc-linux %s -o - | FileCheck %s
+
+NUMBER = 0x6ffffff9
+
+        .text
+.globl  main
+main:
+	cmpwi   8,(NUMBER)@l
+	cmpwi   8,-(NUMBER)@l
+	cmpwi   8,(-NUMBER)@l
+	cmpwi   8,NUMBER at l
+	cmpwi   8,-NUMBER at l
+
+
+// CHECK: main:
+// CHECK: cmpwi 8, -7
+// CHECK: cmpwi 8, 7
+// CHECK: cmpwi 8, 7
+// CHECK: cmpwi 8, -7
+// CHECK: cmpwi 8, 7
+
Index: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
===================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp
@@ -1125,7 +1125,7 @@
     // semantics in the face of reassignment.
     if (Sym->isVariable()) {
       auto V = Sym->getVariableValue(/*SetUsed*/ false);
-      bool DoInline = isa<MCConstantExpr>(V);
+      bool DoInline = isa<MCConstantExpr>(V) && !Variant;
       if (auto TV = dyn_cast<MCTargetExpr>(V))
         DoInline = TV->inlineAssignedExpr();
       if (DoInline) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52188.165822.patch
Type: text/x-patch
Size: 1174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180917/4be82648/attachment.bin>


More information about the llvm-commits mailing list