@@ -320,16 +320,6 @@ bool GenXTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
320320 vc::addPass (PM, createVerifierPass ());
321321 // Run passes to generate vISA.
322322
323- // / .. include:: GenXAggregatePseudoLowering.cpp
324- vc::addPass (PM, createGenXAggregatePseudoLoweringPass ());
325- // / InstructionCombining
326- // / --------------------
327- // / This is a standard LLVM pass, used at this point in the GenX backend.
328- // /
329- vc::addPass (PM, createInstructionCombiningPass ());
330-
331- // Aggregate pseudo lowering may create GEPs to be lowered before TPM
332-
333323 // / BasicAliasAnalysis
334324 // / ------------------
335325 // / This is a standard LLVM analysis pass to provide basic AliasAnalysis
@@ -376,6 +366,12 @@ bool GenXTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
376366 // PrologEpilog may emit memory instructions of illegal width.
377367 vc::addPass (PM, createGenXPrologEpilogInsertionPass ());
378368
369+ // / .. include:: GenXAggregatePseudoLowering.cpp
370+ // / GenXAggregatePseudoLowering must be run after
371+ // / GenXPrologEpilogInsertion as the latter may create stack loads and stores
372+ // / of aggregates.
373+ vc::addPass (PM, createGenXAggregatePseudoLoweringPass ());
374+
379375 // / .. include:: GenXGEPLowering.cpp
380376 vc::addPass (PM, createGenXGEPLoweringPass ());
381377 // / .. include:: GenXLoadStoreLowering.cpp
@@ -387,6 +383,9 @@ bool GenXTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
387383 // / This is a standard LLVM pass, used at this point in the GenX backend.
388384 // / Run instcombine after some lowering passes (e.g. GenXLoadStoreLowering) to
389385 // / make a cleanup.
386+ // / Cleans up after bunch of lowering passes such as
387+ // / GenXPrologEpilogInsertion, GenXAggregatePseudoLowering,
388+ // / GenXLoadStoreLowering.
390389 vc::addPass (PM, createInstructionCombiningPass ());
391390 // Run integer reduction again to revert some trunc/ext patterns transformed
392391 // by instcombine.
0 commit comments