[llvm] r342412 - [MC] Avoid inlining constant symbols with variants.
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 17 13:34:26 PDT 2018
Author: niravd
Date: Mon Sep 17 13:34:26 2018
New Revision: 342412
URL: http://llvm.org/viewvc/llvm-project?rev=342412&view=rev
Log:
[MC] Avoid inlining constant symbols with variants.
Summary:
Defer unnecessary early inlining of constants to symbol
variants. Fixes PR38945.
Reviewers: nickdesaulniers, rnk
Subscribers: nemanjai, hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D52188
Added:
llvm/trunk/test/MC/PowerPC/pr38945.s
Modified:
llvm/trunk/lib/MC/MCParser/AsmParser.cpp
Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=342412&r1=342411&r2=342412&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Mon Sep 17 13:34:26 2018
@@ -1125,7 +1125,7 @@ bool AsmParser::parsePrimaryExpr(const M
// 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) {
Added: llvm/trunk/test/MC/PowerPC/pr38945.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/PowerPC/pr38945.s?rev=342412&view=auto
==============================================================================
--- llvm/trunk/test/MC/PowerPC/pr38945.s (added)
+++ llvm/trunk/test/MC/PowerPC/pr38945.s Mon Sep 17 13:34:26 2018
@@ -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
+
More information about the llvm-commits
mailing list