@@ -145,6 +145,7 @@ void PassManager::invalidate(const std::string &key) {
145145void PassManager::registerStandardPasses (bool debug) {
146146 if (debug) {
147147 registerPass (std::make_unique<lowering::PipelineLowering>());
148+ registerPass (std::make_unique<lowering::ImperativeForFlowLowering>());
148149 registerPass (std::make_unique<parallel::OpenMPPass>());
149150 } else {
150151 // Pythonic
@@ -157,19 +158,29 @@ void PassManager::registerStandardPasses(bool debug) {
157158 registerPass (std::make_unique<lowering::ImperativeForFlowLowering>());
158159
159160 // folding
160- auto seKey =
161- registerAnalysis (std::make_unique<analyze::module ::SideEffectAnalysis>());
161+ auto seKey1 =
162+ registerAnalysis (std::make_unique<analyze::module ::SideEffectAnalysis>(
163+ /* globalAssignmentHasSideEffects=*/ true ));
164+ auto seKey2 =
165+ registerAnalysis (std::make_unique<analyze::module ::SideEffectAnalysis>(
166+ /* globalAssignmentHasSideEffects=*/ false ));
162167 auto cfgKey = registerAnalysis (std::make_unique<analyze::dataflow::CFAnalysis>());
163168 auto rdKey = registerAnalysis (
164169 std::make_unique<analyze::dataflow::RDAnalysis>(cfgKey), {cfgKey});
165170 auto globalKey =
166171 registerAnalysis (std::make_unique<analyze::module ::GlobalVarsAnalyses>());
167- registerPass (std::make_unique<folding::FoldingPassGroup>(seKey, rdKey, globalKey),
168- /* insertBefore=*/ " " , {seKey, rdKey, globalKey},
169- {seKey, rdKey, cfgKey, globalKey});
172+ registerPass (std::make_unique<folding::FoldingPassGroup>(
173+ seKey1, rdKey, globalKey, /* runGlobalDemoton=*/ false ),
174+ /* insertBefore=*/ " " , {seKey1, rdKey, globalKey},
175+ {seKey1, rdKey, cfgKey, globalKey});
170176
171177 // parallel
172178 registerPass (std::make_unique<parallel::OpenMPPass>());
179+
180+ registerPass (std::make_unique<folding::FoldingPassGroup>(seKey2, rdKey, globalKey,
181+ /* runGlobalDemoton=*/ true ),
182+ /* insertBefore=*/ " " , {seKey2, rdKey, globalKey},
183+ {seKey2, rdKey, cfgKey, globalKey});
173184 }
174185}
175186
0 commit comments