@@ -804,30 +804,29 @@ void SILGlobalOpt::optimizeInitializer(SILFunction *AddrF,
804
804
}
805
805
806
806
SILGlobalVariable *SILGlobalOpt::getVariableOfGlobalInit (SILFunction *AddrF) {
807
- if (AddrF->isGlobalInit ()) {
808
- // If the addressor contains a single "once" call, it calls globalinit_func,
809
- // and the globalinit_func is called by "once" from a single location,
810
- // continue; otherwise bail.
811
- BuiltinInst *CallToOnce;
812
- auto *InitF = findInitializer (Module, AddrF, CallToOnce);
813
-
814
- if (!InitF || !InitF->getName ().startswith (" globalinit_" )
815
- || InitializerCount[InitF] > 1 )
816
- return nullptr ;
807
+ if (!AddrF->isGlobalInit ())
808
+ return nullptr ;
817
809
818
- // If the globalinit_func is trivial, continue; otherwise bail.
819
- SingleValueInstruction *dummyInitVal;
820
- auto *SILG = getVariableOfStaticInitializer (InitF, dummyInitVal);
821
- if (!SILG || !SILG-> isDefinition ())
822
- return nullptr ;
810
+ // If the addressor contains a single "once" call, it calls globalinit_func,
811
+ // and the globalinit_func is called by "once" from a single location,
812
+ // continue; otherwise bail.
813
+ BuiltinInst *CallToOnce;
814
+ auto *InitF = findInitializer (Module, AddrF, CallToOnce) ;
823
815
824
- return SILG;
825
- }
826
- return nullptr ;
816
+ if (!InitF || !InitF->getName ().startswith (" globalinit_" )
817
+ || InitializerCount[InitF] > 1 )
818
+ return nullptr ;
819
+
820
+ // If the globalinit_func is trivial, continue; otherwise bail.
821
+ SingleValueInstruction *dummyInitVal;
822
+ auto *SILG = getVariableOfStaticInitializer (InitF, dummyInitVal);
823
+ if (!SILG || !SILG->isDefinition ())
824
+ return nullptr ;
825
+
826
+ return SILG;
827
827
}
828
828
829
829
static bool canBeChangedExternally (SILGlobalVariable *SILG) {
830
-
831
830
// Don't assume anything about globals which are imported from other modules.
832
831
if (isAvailableExternally (SILG->getLinkage ()))
833
832
return true ;
0 commit comments