Skip to content

Commit 5678c93

Browse files
[CodeGen][NPM] Do not implicitly flush pipeline when switching to CGSCC (#173315)
1 parent 2040b55 commit 5678c93

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

llvm/include/llvm/Passes/CodeGenPassBuilder.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,17 @@ template <typename DerivedT, typename TargetMachineT> class CodeGenPassBuilder {
277277

278278
void requireCGSCCOrder(PassManagerWrapper &PMW) const {
279279
assert(!AddInCGSCCOrder);
280-
flushFPMsToMPM(PMW);
280+
assert(PMW.FPM.isEmpty() && PMW.MFPM.isEmpty() &&
281+
"Requiring CGSCC ordering requires flushing the current function "
282+
"pipelines to the MPM.");
281283
AddInCGSCCOrder = true;
282284
}
285+
283286
void stopAddingInCGSCCOrder(PassManagerWrapper &PMW) const {
284287
assert(AddInCGSCCOrder);
285-
flushFPMsToMPM(PMW);
288+
assert(PMW.FPM.isEmpty() && PMW.MFPM.isEmpty() &&
289+
"Stopping CGSCC ordering requires flushing the current function "
290+
"pipelines to the MPM.");
286291
AddInCGSCCOrder = false;
287292
}
288293

llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,6 +2206,7 @@ void AMDGPUCodeGenPassBuilder::addCodeGenPrepare(
22062206
// many cases.
22072207
flushFPMsToMPM(PMW);
22082208
addModulePass(AMDGPULowerBufferFatPointersPass(TM), PMW);
2209+
flushFPMsToMPM(PMW);
22092210
requireCGSCCOrder(PMW);
22102211

22112212
addModulePass(AMDGPULowerIntrinsicsPass(TM), PMW);

0 commit comments

Comments
 (0)