[llvm] r293318 - [AMDGPU] Grab MCSubtargetInfo from TargetMachine instead of constructing it

Konstantin Zhuravlyov via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 10:32:40 PST 2017


Author: kzhuravl
Date: Fri Jan 27 12:32:40 2017
New Revision: 293318

URL: http://llvm.org/viewvc/llvm-project?rev=293318&view=rev
Log:
[AMDGPU] Grab MCSubtargetInfo from TargetMachine instead of constructing it

Differential Revision: https://reviews.llvm.org/D29224

Modified:
    llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp

Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp?rev=293318&r1=293317&r2=293318&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp Fri Jan 27 12:32:40 2017
@@ -103,17 +103,12 @@ void AMDGPUAsmPrinter::EmitStartOfAsmFil
   if (TM.getTargetTriple().getOS() != Triple::AMDHSA)
     return;
 
-  // Need to construct an MCSubtargetInfo here in case we have no functions
-  // in the module.
-  std::unique_ptr<MCSubtargetInfo> STI(TM.getTarget().createMCSubtargetInfo(
-        TM.getTargetTriple().str(), TM.getTargetCPU(),
-        TM.getTargetFeatureString()));
-
   AMDGPUTargetStreamer *TS =
       static_cast<AMDGPUTargetStreamer *>(OutStreamer->getTargetStreamer());
 
   TS->EmitDirectiveHSACodeObjectVersion(2, 1);
 
+  const MCSubtargetInfo *STI = TM.getMCSubtargetInfo();
   AMDGPU::IsaVersion ISA = AMDGPU::getIsaVersion(STI->getFeatureBits());
   TS->EmitDirectiveHSACodeObjectISA(ISA.Major, ISA.Minor, ISA.Stepping,
                                     "AMD", "AMDGPU");




More information about the llvm-commits mailing list