@@ -10881,32 +10881,30 @@ RefPtr<IRModule> generateIRForTranslationUnit(
10881
10881
// are eliminated from the callee, and not copied into
10882
10882
// call sites.
10883
10883
//
10884
+ HashSet<IRInst*>* modifiedFuncs = module->getContainerPool().getHashSet<IRInst>();
10885
+ SLANG_DEFER(module->getContainerPool().free(modifiedFuncs));
10886
+ bool minimumOptimizations = sharedContextStorage.m_linkage->m_optionSet.getBoolOption(CompilerOptionName::MinimumSlangOptimization);
10884
10887
for (;;)
10885
10888
{
10886
10889
bool changed = false;
10887
- changed |= performMandatoryEarlyInlining(module);
10888
- if (!changed)
10889
- break;
10890
- }
10891
-
10892
- // Optionally, run optimization after inlining.
10893
- if (!sharedContextStorage.m_linkage->m_optionSet.getBoolOption(CompilerOptionName::MinimumSlangOptimization))
10894
- {
10895
- for (;;)
10890
+ modifiedFuncs->clear();
10891
+ changed = performMandatoryEarlyInlining(module, modifiedFuncs);
10892
+ if (changed)
10896
10893
{
10897
- bool changed = false;
10898
- changed |= constructSSA(module);
10899
- simplifyCFG(module, CFGSimplificationOptions::getDefault());
10900
- changed |= applySparseConditionalConstantPropagation(module, compileRequest->getSink());
10901
- changed |= peepholeOptimize(nullptr, module, PeepholeOptimizationOptions::getPrelinking());
10902
- for (auto inst : module->getGlobalInsts())
10894
+ changed = peepholeOptimizeGlobalScope(nullptr, module);
10895
+ if (!minimumOptimizations)
10903
10896
{
10904
- if (auto func = as<IRGlobalValueWithCode>(inst))
10897
+ for (auto func : *modifiedFuncs)
10898
+ {
10899
+ changed |= constructSSA(func);
10900
+ changed |= applySparseConditionalConstantPropagation(func, compileRequest->getSink());
10901
+ changed |= peepholeOptimize(nullptr, func);
10905
10902
eliminateDeadCode(func);
10903
+ }
10906
10904
}
10907
- if (!changed)
10908
- break;
10909
10905
}
10906
+ if (!changed)
10907
+ break;
10910
10908
}
10911
10909
10912
10910
// Check for using uninitialized out parameters.
0 commit comments