diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp index eb488843b53e0..92ab106dd4a98 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -1151,6 +1151,7 @@ class GCNPassConfig final : public AMDGPUPassConfig { void addPostRegAlloc() override; void addPreSched2() override; void addPreEmitPass() override; + void addPostBBSections() override; }; } // end anonymous namespace @@ -1690,6 +1691,11 @@ void GCNPassConfig::addPreEmitPass() { addPass(&AMDGPUInsertDelayAluID); addPass(&BranchRelaxationPassID); +} + +void GCNPassConfig::addPostBBSections() { + // We run this later to avoid passes like livedebugvalues and BBSections + // having to deal with the apparent multi-entry functions we may generate. addPass(createAMDGPUPreloadKernArgPrologLegacyPass()); } diff --git a/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll b/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll index 893b9fa6fb40d..d7f54f3b8e9e2 100644 --- a/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll +++ b/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll @@ -145,11 +145,11 @@ ; GCN-O0-NEXT: Post RA hazard recognizer ; GCN-O0-NEXT: AMDGPU Insert waits for SGPR read hazards ; GCN-O0-NEXT: Branch relaxation pass -; GCN-O0-NEXT: AMDGPU Preload Kernel Arguments Prolog ; GCN-O0-NEXT: Register Usage Information Collector Pass ; GCN-O0-NEXT: Remove Loads Into Fake Uses ; GCN-O0-NEXT: Live DEBUG_VALUE analysis ; GCN-O0-NEXT: Machine Sanitizer Binary Metadata +; GCN-O0-NEXT: AMDGPU Preload Kernel Arguments Prolog ; GCN-O0-NEXT: Lazy Machine Block Frequency Analysis ; GCN-O0-NEXT: Machine Optimization Remark Emitter ; GCN-O0-NEXT: Stack Frame Layout Analysis @@ -430,11 +430,11 @@ ; GCN-O1-NEXT: AMDGPU Insert waits for SGPR read hazards ; GCN-O1-NEXT: AMDGPU Insert Delay ALU ; GCN-O1-NEXT: Branch relaxation pass -; GCN-O1-NEXT: AMDGPU Preload Kernel Arguments Prolog ; GCN-O1-NEXT: Register Usage Information Collector Pass ; GCN-O1-NEXT: Remove Loads Into Fake Uses ; GCN-O1-NEXT: Live DEBUG_VALUE analysis ; GCN-O1-NEXT: Machine Sanitizer Binary Metadata +; GCN-O1-NEXT: AMDGPU Preload Kernel Arguments Prolog ; GCN-O1-NEXT: Lazy Machine Block Frequency Analysis ; GCN-O1-NEXT: Machine Optimization Remark Emitter ; GCN-O1-NEXT: Stack Frame Layout Analysis @@ -743,11 +743,11 @@ ; GCN-O1-OPTS-NEXT: AMDGPU Insert waits for SGPR read hazards ; GCN-O1-OPTS-NEXT: AMDGPU Insert Delay ALU ; GCN-O1-OPTS-NEXT: Branch relaxation pass -; GCN-O1-OPTS-NEXT: AMDGPU Preload Kernel Arguments Prolog ; GCN-O1-OPTS-NEXT: Register Usage Information Collector Pass ; GCN-O1-OPTS-NEXT: Remove Loads Into Fake Uses ; GCN-O1-OPTS-NEXT: Live DEBUG_VALUE analysis ; GCN-O1-OPTS-NEXT: Machine Sanitizer Binary Metadata +; GCN-O1-OPTS-NEXT: AMDGPU Preload Kernel Arguments Prolog ; GCN-O1-OPTS-NEXT: Lazy Machine Block Frequency Analysis ; GCN-O1-OPTS-NEXT: Machine Optimization Remark Emitter ; GCN-O1-OPTS-NEXT: Stack Frame Layout Analysis @@ -1062,11 +1062,11 @@ ; GCN-O2-NEXT: AMDGPU Insert waits for SGPR read hazards ; GCN-O2-NEXT: AMDGPU Insert Delay ALU ; GCN-O2-NEXT: Branch relaxation pass -; GCN-O2-NEXT: AMDGPU Preload Kernel Arguments Prolog ; GCN-O2-NEXT: Register Usage Information Collector Pass ; GCN-O2-NEXT: Remove Loads Into Fake Uses ; GCN-O2-NEXT: Live DEBUG_VALUE analysis ; GCN-O2-NEXT: Machine Sanitizer Binary Metadata +; GCN-O2-NEXT: AMDGPU Preload Kernel Arguments Prolog ; GCN-O2-NEXT: Lazy Machine Block Frequency Analysis ; GCN-O2-NEXT: Machine Optimization Remark Emitter ; GCN-O2-NEXT: Stack Frame Layout Analysis @@ -1394,11 +1394,11 @@ ; GCN-O3-NEXT: AMDGPU Insert waits for SGPR read hazards ; GCN-O3-NEXT: AMDGPU Insert Delay ALU ; GCN-O3-NEXT: Branch relaxation pass -; GCN-O3-NEXT: AMDGPU Preload Kernel Arguments Prolog ; GCN-O3-NEXT: Register Usage Information Collector Pass ; GCN-O3-NEXT: Remove Loads Into Fake Uses ; GCN-O3-NEXT: Live DEBUG_VALUE analysis ; GCN-O3-NEXT: Machine Sanitizer Binary Metadata +; GCN-O3-NEXT: AMDGPU Preload Kernel Arguments Prolog ; GCN-O3-NEXT: Lazy Machine Block Frequency Analysis ; GCN-O3-NEXT: Machine Optimization Remark Emitter ; GCN-O3-NEXT: Stack Frame Layout Analysis