@@ -432,7 +432,7 @@ void NVPTXAsmPrinter::emitKernelFunctionDirectives(const Function &F,
432432 // .maxclusterrank directive requires SM_90 or higher, make sure that we
433433 // filter it out for lower SM versions, as it causes a hard ptxas crash.
434434 const NVPTXTargetMachine &NTM = static_cast <const NVPTXTargetMachine &>(TM);
435- const auto *STI = static_cast < const NVPTXSubtarget *>(NTM. getSubtargetImpl () );
435+ const NVPTXSubtarget *STI = &NTM. getSubtarget < NVPTXSubtarget>(F );
436436
437437 if (STI->getSmVersion () >= 90 ) {
438438 const auto ClusterDim = getClusterDim (F);
@@ -669,7 +669,7 @@ void NVPTXAsmPrinter::emitStartOfAsmFile(Module &M) {
669669 // rest of NVPTX isn't friendly to change subtargets per function and
670670 // so the default TargetMachine will have all of the options.
671671 const NVPTXTargetMachine &NTM = static_cast <const NVPTXTargetMachine &>(TM);
672- const auto * STI = static_cast < const NVPTXSubtarget*>( NTM.getSubtargetImpl () );
672+ const NVPTXSubtarget * STI = NTM.getSubtargetImpl ();
673673 SmallString<128 > Str1;
674674 raw_svector_ostream OS1 (Str1);
675675
@@ -680,8 +680,7 @@ void NVPTXAsmPrinter::emitStartOfAsmFile(Module &M) {
680680
681681bool NVPTXAsmPrinter::doInitialization (Module &M) {
682682 const NVPTXTargetMachine &NTM = static_cast <const NVPTXTargetMachine &>(TM);
683- const NVPTXSubtarget &STI =
684- *static_cast <const NVPTXSubtarget *>(NTM.getSubtargetImpl ());
683+ const NVPTXSubtarget &STI = *NTM.getSubtargetImpl ();
685684 if (M.alias_size () && (STI.getPTXVersion () < 63 || STI.getSmVersion () < 30 ))
686685 report_fatal_error (" .alias requires PTX version >= 6.3 and sm_30" );
687686
@@ -716,8 +715,7 @@ void NVPTXAsmPrinter::emitGlobals(const Module &M) {
716715 assert (GVVisiting.size () == 0 && " Did not fully process a global variable" );
717716
718717 const NVPTXTargetMachine &NTM = static_cast <const NVPTXTargetMachine &>(TM);
719- const NVPTXSubtarget &STI =
720- *static_cast <const NVPTXSubtarget *>(NTM.getSubtargetImpl ());
718+ const NVPTXSubtarget &STI = *NTM.getSubtargetImpl ();
721719
722720 // Print out module-level global variables in proper order
723721 for (const GlobalVariable *GV : Globals)
@@ -1178,8 +1176,7 @@ void NVPTXAsmPrinter::emitDemotedVars(const Function *F, raw_ostream &O) {
11781176 ArrayRef<const GlobalVariable *> GVars = It->second ;
11791177
11801178 const NVPTXTargetMachine &NTM = static_cast <const NVPTXTargetMachine &>(TM);
1181- const NVPTXSubtarget &STI =
1182- *static_cast <const NVPTXSubtarget *>(NTM.getSubtargetImpl ());
1179+ const NVPTXSubtarget &STI = *NTM.getSubtargetImpl ();
11831180
11841181 for (const GlobalVariable *GV : GVars) {
11851182 O << " \t // demoted variable\n\t " ;
0 commit comments