[llvm] 5193f2a - Revert "[NVPTX] Disable parens for identifiers starting with '$'"
Andrew Savonichev via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 14 11:26:50 PDT 2022
Author: Andrew Savonichev
Date: 2022-04-14T21:25:31+03:00
New Revision: 5193f2a55816c484c3343a5fc04dbd30e22a372c
URL: https://github.com/llvm/llvm-project/commit/5193f2a55816c484c3343a5fc04dbd30e22a372c
DIFF: https://github.com/llvm/llvm-project/commit/5193f2a55816c484c3343a5fc04dbd30e22a372c.diff
LOG: Revert "[NVPTX] Disable parens for identifiers starting with '$'"
This reverts commit 78d70a1c976934587e6d4c5698c348b8f09d9d96.
Failed on Mips32:
https://lab.llvm.org/buildbot#builders/109/builds/36628
# CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26
<stdin>:580:2: note: possible intended match here
# fixup A - offset: 0, value: $tmp0, kind: fixup_Mips_26
Added:
Modified:
llvm/include/llvm/MC/MCAsmInfo.h
llvm/lib/MC/MCExpr.cpp
llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
Removed:
llvm/test/CodeGen/NVPTX/no-extra-parens.ll
################################################################################
diff --git a/llvm/include/llvm/MC/MCAsmInfo.h b/llvm/include/llvm/MC/MCAsmInfo.h
index 578518e6dc80a..1be65a77610b3 100644
--- a/llvm/include/llvm/MC/MCAsmInfo.h
+++ b/llvm/include/llvm/MC/MCAsmInfo.h
@@ -478,10 +478,6 @@ class MCAsmInfo {
/// For example, foo(plt) instead of foo at plt. Defaults to false.
bool UseParensForSymbolVariant = false;
- /// True if the target uses parens for symbol names starting with
- /// '$' character to distinguish them from absolute names.
- bool UseParensForDollarSignNames = true;
-
/// True if the target supports flags in ".loc" directive, false if only
/// location is allowed.
bool SupportsExtendedDwarfLocDirective = true;
@@ -793,9 +789,6 @@ class MCAsmInfo {
bool doDwarfFDESymbolsUseAbsDiff() const { return DwarfFDESymbolsUseAbsDiff; }
bool useDwarfRegNumForCFI() const { return DwarfRegNumForCFI; }
bool useParensForSymbolVariant() const { return UseParensForSymbolVariant; }
- bool useParensForDollarSignNames() const {
- return UseParensForDollarSignNames;
- }
bool supportsExtendedDwarfLocDirective() const {
return SupportsExtendedDwarfLocDirective;
}
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index 45a3d938257ae..64deb041ce5d7 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -75,9 +75,8 @@ void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens) const {
const MCSymbol &Sym = SRE.getSymbol();
// Parenthesize names that start with $ so that they don't look like
// absolute names.
- bool UseParens = MAI && MAI->useParensForDollarSignNames() && !InParens &&
- !Sym.getName().empty() && Sym.getName()[0] == '$';
-
+ bool UseParens =
+ !InParens && !Sym.getName().empty() && Sym.getName()[0] == '$';
if (UseParens) {
OS << '(';
Sym.print(OS, MAI);
diff --git a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
index 6bc3e43db1d6f..f275011018a32 100644
--- a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
+++ b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
@@ -54,8 +54,4 @@ NVPTXMCAsmInfo::NVPTXMCAsmInfo(const Triple &TheTriple,
GlobalDirective = "\t// .globl\t";
UseIntegratedAssembler = false;
-
- // Avoid using parens for identifiers starting with $ - ptxas does
- // not expect them.
- UseParensForDollarSignNames = false;
}
diff --git a/llvm/test/CodeGen/NVPTX/no-extra-parens.ll b/llvm/test/CodeGen/NVPTX/no-extra-parens.ll
deleted file mode 100644
index 22a89b8096306..0000000000000
--- a/llvm/test/CodeGen/NVPTX/no-extra-parens.ll
+++ /dev/null
@@ -1,14 +0,0 @@
-; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 | FileCheck %s
-
-; ptxas has no special meaning for '$' character, so it should be used
-; without parens.
-
-@"$str" = private addrspace(1) constant [4 x i8] c"str\00"
-
-declare void @str2(i8* %str)
-define void @str1() {
-entry:
-;; CHECK: mov.u64 %rd{{[0-9]+}}, $str;
- tail call void @str2(i8* getelementptr ([4 x i8], [4 x i8]* addrspacecast ([4 x i8] addrspace(1)* @"$str" to [4 x i8]*), i64 0, i64 0))
- ret void
-}
More information about the llvm-commits
mailing list