@@ -3398,13 +3398,6 @@ bool SPIRVInstructionSelector::selectGlobalValue(
33983398 GVType, MIRBuilder, SPIRV::AccessQualifier::ReadWrite, false );
33993399 }
34003400
3401- const unsigned AddrSpace = GV->getAddressSpace ();
3402- SPIRV::StorageClass::StorageClass StorageClass =
3403- addressSpaceToStorageClass (AddrSpace, STI);
3404-
3405- SPIRVType *ResType =
3406- GR.getOrCreateSPIRVPointerType (PointerBaseType, I, TII, StorageClass);
3407-
34083401 std::string GlobalIdent;
34093402 if (!GV->hasName ()) {
34103403 unsigned &ID = UnnamedGlobalIDs[GV];
@@ -3487,6 +3480,11 @@ bool SPIRVInstructionSelector::selectGlobalValue(
34873480 ? SPIRV::LinkageType::LinkOnceODR
34883481 : SPIRV::LinkageType::Export);
34893482
3483+ const unsigned AddrSpace = GV->getAddressSpace ();
3484+ SPIRV::StorageClass::StorageClass StorageClass =
3485+ addressSpaceToStorageClass (AddrSpace, STI);
3486+ SPIRVType *ResType =
3487+ GR.getOrCreateSPIRVPointerType (PointerBaseType, I, TII, StorageClass);
34903488 Register Reg = GR.buildGlobalVariable (
34913489 ResVReg, ResType, GlobalIdent, GV, StorageClass, Init,
34923490 GlobalVar->isConstant (), HasLnkTy, LnkType, MIRBuilder, true );
0 commit comments