[llvm] r349982 - [NVPTX] Reduce stack size in NVPTXAsmPrinter::doInitialization().
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 21 17:30:37 PST 2018
Author: jlebar
Date: Fri Dec 21 17:30:37 2018
New Revision: 349982
URL: http://llvm.org/viewvc/llvm-project?rev=349982&view=rev
Log:
[NVPTX] Reduce stack size in NVPTXAsmPrinter::doInitialization().
NVPTXAsmPrinter::doInitialization() was creating an NVPTXSubtarget on
the stack. This object is huge, about 80kb. Also it's slow to create.
And it's all redundant; we have one in NVPTXTargetMachine anyway!
Modified:
llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp?rev=349982&r1=349981&r2=349982&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp Fri Dec 21 17:30:37 2018
@@ -788,11 +788,8 @@ bool NVPTXAsmPrinter::doInitialization(M
// Construct a default subtarget off of the TargetMachine defaults. The
// rest of NVPTX isn't friendly to change subtargets per function and
// so the default TargetMachine will have all of the options.
- const Triple &TT = TM.getTargetTriple();
- StringRef CPU = TM.getTargetCPU();
- StringRef FS = TM.getTargetFeatureString();
const NVPTXTargetMachine &NTM = static_cast<const NVPTXTargetMachine &>(TM);
- const NVPTXSubtarget STI(TT, CPU, FS, NTM);
+ const auto* STI = static_cast<const NVPTXSubtarget*>(NTM.getSubtargetImpl());
if (M.alias_size()) {
report_fatal_error("Module has aliases, which NVPTX does not support.");
@@ -816,7 +813,7 @@ bool NVPTXAsmPrinter::doInitialization(M
bool Result = AsmPrinter::doInitialization(M);
// Emit header before any dwarf directives are emitted below.
- emitHeader(M, OS1, STI);
+ emitHeader(M, OS1, *STI);
OutStreamer->EmitRawText(OS1.str());
// Emit module-level inline asm if it exists.
More information about the llvm-commits
mailing list