@@ -432,7 +432,7 @@ void NVPTXAsmPrinter::emitKernelFunctionDirectives(const Function &F,
432
432
// .maxclusterrank directive requires SM_90 or higher, make sure that we
433
433
// filter it out for lower SM versions, as it causes a hard ptxas crash.
434
434
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 );
436
436
437
437
if (STI->getSmVersion () >= 90 ) {
438
438
const auto ClusterDim = getClusterDim (F);
@@ -669,7 +669,7 @@ void NVPTXAsmPrinter::emitStartOfAsmFile(Module &M) {
669
669
// rest of NVPTX isn't friendly to change subtargets per function and
670
670
// so the default TargetMachine will have all of the options.
671
671
const NVPTXTargetMachine &NTM = static_cast <const NVPTXTargetMachine &>(TM);
672
- const auto * STI = static_cast < const NVPTXSubtarget*>( NTM.getSubtargetImpl () );
672
+ const NVPTXSubtarget * STI = NTM.getSubtargetImpl ();
673
673
SmallString<128 > Str1;
674
674
raw_svector_ostream OS1 (Str1);
675
675
@@ -680,8 +680,7 @@ void NVPTXAsmPrinter::emitStartOfAsmFile(Module &M) {
680
680
681
681
bool NVPTXAsmPrinter::doInitialization (Module &M) {
682
682
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 ();
685
684
if (M.alias_size () && (STI.getPTXVersion () < 63 || STI.getSmVersion () < 30 ))
686
685
report_fatal_error (" .alias requires PTX version >= 6.3 and sm_30" );
687
686
@@ -716,8 +715,7 @@ void NVPTXAsmPrinter::emitGlobals(const Module &M) {
716
715
assert (GVVisiting.size () == 0 && " Did not fully process a global variable" );
717
716
718
717
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 ();
721
719
722
720
// Print out module-level global variables in proper order
723
721
for (const GlobalVariable *GV : Globals)
@@ -1178,8 +1176,7 @@ void NVPTXAsmPrinter::emitDemotedVars(const Function *F, raw_ostream &O) {
1178
1176
ArrayRef<const GlobalVariable *> GVars = It->second ;
1179
1177
1180
1178
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 ();
1183
1180
1184
1181
for (const GlobalVariable *GV : GVars) {
1185
1182
O << " \t // demoted variable\n\t " ;
0 commit comments