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

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 17 13:13:52 PDT 2018


nickdesaulniers added inline comments.


================
Comment at: llvm/lib/MC/MCParser/AsmParser.cpp:1128
       auto V = Sym->getVariableValue(/*SetUsed*/ false);
-      bool DoInline = isa<MCConstantExpr>(V);
+      bool DoInline = isa<MCConstantExpr>(V) && !Variant;
       if (auto TV = dyn_cast<MCTargetExpr>(V))
----------------
I'm not super enthused about relying on the enum's value being zero as opposed to checking that `Variant == MCSymbolRefExpr::VK_None`, but it looks like it's done so anyways on L1132, so I guess it's fine.


================
Comment at: llvm/test/MC/PowerPC/pr38945.s:9
+	cmpwi   8,(NUMBER)@l
+	cmpwi   8,NUMBER at l
+
----------------
Can you add a test for the `-` prefix for negating the number, too (assuming it works and doesn't need additional code changed)?

ie

```
cmpwi 8,(-NUMBER)@l
cmpwi 8,-NUMBER at l
```


Repository:
  rL LLVM

https://reviews.llvm.org/D52188





More information about the llvm-commits mailing list