Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions llvm/include/llvm/CodeGen/TargetPassConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,15 @@ class LLVM_ABI TargetPassConfig : public ImmutablePass {
return true;
}

/// Add passes at the start of the function pass manager created after
/// enforcing CGSCC ordering. This hook is only called when
/// requiresCodeGenSCCOrder() returns true.
///
/// Targets can use this to insert passes that need to run at the beginning
/// of the codegen function pass manager, after the CGSCC boundary has been
/// established.
virtual void addInitialCGSCCCodeGenPasses() {}

/// addMachineSSAOptimization - Add standard passes that optimize machine
/// instructions in SSA form.
virtual void addMachineSSAOptimization();
Expand Down
4 changes: 3 additions & 1 deletion llvm/lib/CodeGen/TargetPassConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,8 +966,10 @@ void TargetPassConfig::addISelPrepare() {
addPreISel();

// Force codegen to run according to the callgraph.
if (requiresCodeGenSCCOrder())
if (requiresCodeGenSCCOrder()) {
addPass(new DummyCGSCCPass);
addInitialCGSCCCodeGenPasses();
}

if (getOptLevel() != CodeGenOptLevel::None)
addPass(createObjCARCContractPass());
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,7 @@ class GCNPassConfig final : public AMDGPUPassConfig {
}

bool addPreISel() override;
void addInitialCGSCCCodeGenPasses() override;
void addMachineSSAOptimization() override;
bool addILPOpts() override;
bool addInstSelector() override;
Expand Down Expand Up @@ -1504,6 +1505,11 @@ bool GCNPassConfig::addPreISel() {
return false;
}

void GCNPassConfig::addInitialCGSCCCodeGenPasses() {
if (EnableAMDGPUMachineLevelInliner)
addPass(createAMDGPUInliningAnchorPass());
}

void GCNPassConfig::addMachineSSAOptimization() {
TargetPassConfig::addMachineSSAOptimization();

Expand Down
7 changes: 2 additions & 5 deletions llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,8 @@
; INLINER-NEXT: Loop-Closed SSA Form Pass
; INLINER-NEXT: Analysis if a function is memory bound
; INLINER-NEXT: DummyCGSCCPass
; INLINER-NEXT: FunctionPass Manager
; INLINER-NEXT: AMDGPU Inlining Pass Manager
; INLINER-NEXT: AMDGPU Inlining Anchor
; INLINER-NEXT: Dominator Tree Construction
; INLINER-NEXT: Basic Alias Analysis (stateless AA impl)
; INLINER-NEXT: Function Alias Analysis Results
Expand Down Expand Up @@ -1745,15 +1746,11 @@
; INLINER-NEXT: Machine Copy Propagation Pass
; INLINER-NEXT: Post-RA pseudo instruction expansion pass
; INLINER-NEXT: SI Shrink Instructions
; INLINER-NEXT: AMDGPU Inlining Pass Manager
; INLINER-NEXT: AMDGPU Inlining Anchor
; INLINER-NEXT: AMDGPU Machine Level Inliner
; INLINER-NEXT: SI post-RA bundler
; INLINER-NEXT: MachineDominator Tree Construction
; INLINER-NEXT: Machine Natural Loop Construction
; INLINER-NEXT: Dominator Tree Construction
; INLINER-NEXT: Basic Alias Analysis (stateless AA impl)
; INLINER-NEXT: Function Alias Analysis Results
; INLINER-NEXT: PostRA Machine Instruction Scheduler
; INLINER-NEXT: Machine Block Frequency Analysis
; INLINER-NEXT: MachinePostDominator Tree Construction
Expand Down
Loading