[llvm] AMDGPU/NewPM: Fill out addPreISelPasses (PR #102814)
Sameer Sahasrabuddhe via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 14 11:19:15 PDT 2024
================
@@ -28,8 +36,51 @@ AMDGPUCodeGenPassBuilder::AMDGPUCodeGenPassBuilder(
}
void AMDGPUCodeGenPassBuilder::addPreISel(AddIRPass &addPass) const {
- // TODO: Add passes pre instruction selection.
- // Test only, convert to real IR passes in future.
+ const bool LateCFGStructurize = AMDGPUTargetMachine::EnableLateStructurizeCFG;
+ const bool DisableStructurizer = AMDGPUTargetMachine::DisableStructurizer;
+ const bool EnableStructurizerWorkarounds =
+ AMDGPUTargetMachine::EnableStructurizerWorkarounds;
+
+ if (TM.getOptLevel() > CodeGenOptLevel::None)
+ addPass(FlattenCFGPass());
+
+ if (TM.getOptLevel() > CodeGenOptLevel::None)
+ addPass(SinkingPass());
+
+ addPass(AMDGPULateCodeGenPreparePass(TM));
+
+ // Merge divergent exit nodes. StructurizeCFG won't recognize the multi-exit
+ // regions formed by them.
+
+ addPass(AMDGPUUnifyDivergentExitNodesPass());
+
+ if (!LateCFGStructurize && !DisableStructurizer) {
+ if (EnableStructurizerWorkarounds) {
----------------
ssahasra wrote:
Sorry about that! I meant the option to disable the workarounds. They have been on by default for a very long time.
https://github.com/llvm/llvm-project/pull/102814
More information about the llvm-commits
mailing list