[llvm] b61a4aa - [MC] Default MCContext::UseNamesOnTempLabels to false and only set it to true for MCAsmStreamer
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 25 18:25:19 PST 2020
Author: Fangrui Song
Date: 2020-02-25T18:23:10-08:00
New Revision: b61a4aaca5f8a1e71eeaee74d93cdd6fccbef065
URL: https://github.com/llvm/llvm-project/commit/b61a4aaca5f8a1e71eeaee74d93cdd6fccbef065
DIFF: https://github.com/llvm/llvm-project/commit/b61a4aaca5f8a1e71eeaee74d93cdd6fccbef065.diff
LOG: [MC] Default MCContext::UseNamesOnTempLabels to false and only set it to true for MCAsmStreamer
Only MCAsmStreamer (assembly output) needs to keep names of temporary labels created by
MCContext::createTempSymbol().
This change made the rL236642 optimization available for cc2as and
probably some other users.
This eliminates a behavior difference between llvm-mc -filetype=obj and cc1as, which caused
https://reviews.llvm.org/D74006#1890487
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D75097
Added:
Modified:
llvm/include/llvm/MC/MCContext.h
llvm/lib/CodeGen/LLVMTargetMachine.cpp
llvm/lib/MC/MCAsmStreamer.cpp
llvm/tools/llvm-mc/llvm-mc.cpp
llvm/tools/llvm-ml/llvm-ml.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h
index 7d2997967096..9e02bd1a4be0 100644
--- a/llvm/include/llvm/MC/MCContext.h
+++ b/llvm/include/llvm/MC/MCContext.h
@@ -188,7 +188,7 @@ namespace llvm {
///
diff erences between temporary and non-temporary labels (primarily on
/// Darwin).
bool AllowTemporaryLabels = true;
- bool UseNamesOnTempLabels = true;
+ bool UseNamesOnTempLabels = false;
/// The Compile Unit ID that we are currently processing.
unsigned DwarfCompileUnitID = 0;
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index 50c178ff7598..b485f2cf7261 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -157,9 +157,6 @@ bool LLVMTargetMachine::addAsmPrinter(PassManagerBase &PM,
if (!MCE || !MAB)
return true;
- // Don't waste memory on names of temp labels.
- Context.setUseNamesOnTempLabels(false);
-
Triple T(getTargetTriple().str());
AsmStreamer.reset(getTarget().createMCObjectStreamer(
T, Context, std::unique_ptr<MCAsmBackend>(MAB),
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 92815844e0cb..3792655d0bf2 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -79,6 +79,8 @@ class MCAsmStreamer final : public MCStreamer {
InstPrinter->setCommentStream(CommentStream);
if (Assembler->getBackendPtr())
setAllowAutoPadding(Assembler->getBackend().allowAutoPadding());
+
+ Context.setUseNamesOnTempLabels(true);
}
MCAssembler &getAssembler() { return *Assembler; }
diff --git a/llvm/tools/llvm-mc/llvm-mc.cpp b/llvm/tools/llvm-mc/llvm-mc.cpp
index 25f02b92dada..dadb7f5ca22f 100644
--- a/llvm/tools/llvm-mc/llvm-mc.cpp
+++ b/llvm/tools/llvm-mc/llvm-mc.cpp
@@ -474,9 +474,6 @@ int main(int argc, char **argv) {
} else {
assert(FileType == OFT_ObjectFile && "Invalid file type!");
- // Don't waste memory on names of temp labels.
- Ctx.setUseNamesOnTempLabels(false);
-
if (!Out->os().supportsSeeking()) {
BOS = std::make_unique<buffer_ostream>(Out->os());
OS = BOS.get();
diff --git a/llvm/tools/llvm-ml/llvm-ml.cpp b/llvm/tools/llvm-ml/llvm-ml.cpp
index 2e8ecd95f6b9..5eefc1e518fd 100644
--- a/llvm/tools/llvm-ml/llvm-ml.cpp
+++ b/llvm/tools/llvm-ml/llvm-ml.cpp
@@ -333,9 +333,6 @@ int main(int argc, char **argv) {
} else {
assert(FileType == OFT_ObjectFile && "Invalid file type!");
- // Don't waste memory on names of temp labels.
- Ctx.setUseNamesOnTempLabels(false);
-
if (!Out->os().supportsSeeking()) {
BOS = std::make_unique<buffer_ostream>(Out->os());
OS = BOS.get();
More information about the llvm-commits
mailing list