[llvm] [CodeGen][NPM] Do not implicitly flush pipeline when switching to CGSCC (PR #173315)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 22 15:03:10 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Aiden Grossman (boomanaiden154)
<details>
<summary>Changes</summary>
Before this patch, switching to and from CGSCC ordering would implicitly flush the pipeline. #<!-- -->169867 tried to make breaking up the function pipeline more explicit, which this kind of defeats. Remove the implict flushing and add an assertion to ensure correct behavior is preserved.
---
Full diff: https://github.com/llvm/llvm-project/pull/173315.diff
2 Files Affected:
- (modified) llvm/include/llvm/Passes/CodeGenPassBuilder.h (+7-2)
- (modified) llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp (+1)
``````````diff
diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
index d0246f8006dd6..2cdf5262fabde 100644
--- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h
+++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
@@ -277,12 +277,17 @@ template <typename DerivedT, typename TargetMachineT> class CodeGenPassBuilder {
void requireCGSCCOrder(PassManagerWrapper &PMW) const {
assert(!AddInCGSCCOrder);
- flushFPMsToMPM(PMW);
+ assert(PMW.FPM.isEmpty() && PMW.MFPM.isEmpty() &&
+ "Requiring CGSCC ordering requires flushing the current function "
+ "pipelines to the MPM.");
AddInCGSCCOrder = true;
}
+
void stopAddingInCGSCCOrder(PassManagerWrapper &PMW) const {
assert(AddInCGSCCOrder);
- flushFPMsToMPM(PMW);
+ assert(PMW.FPM.isEmpty() && PMW.MFPM.isEmpty() &&
+ "Stopping CGSCC ordering requires flushing the current function "
+ "pipelines to the MPM.");
AddInCGSCCOrder = false;
}
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index c24962dccdd65..309e92a2ee88e 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -2206,6 +2206,7 @@ void AMDGPUCodeGenPassBuilder::addCodeGenPrepare(
// many cases.
flushFPMsToMPM(PMW);
addModulePass(AMDGPULowerBufferFatPointersPass(TM), PMW);
+ flushFPMsToMPM(PMW);
requireCGSCCOrder(PMW);
addModulePass(AMDGPULowerIntrinsicsPass(TM), PMW);
``````````
</details>
https://github.com/llvm/llvm-project/pull/173315
More information about the llvm-commits
mailing list