[llvm] 5b5bd81 - AMDGPU: Move placement of RemoveIncompatibleFunctions
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 31 16:33:41 PDT 2023
Author: Matt Arsenault
Date: 2023-07-31T19:22:04-04:00
New Revision: 5b5bd81b7170536c4d3ce26c48bba13bf2717698
URL: https://github.com/llvm/llvm-project/commit/5b5bd81b7170536c4d3ce26c48bba13bf2717698
DIFF: https://github.com/llvm/llvm-project/commit/5b5bd81b7170536c4d3ce26c48bba13bf2717698.diff
LOG: AMDGPU: Move placement of RemoveIncompatibleFunctions
This should be approximately first and run with other module passes.
https://reviews.llvm.org/D155987
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index 87ef2333e2ea92..ec12b3fb6a071d 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -966,6 +966,10 @@ void AMDGPUPassConfig::addStraightLineScalarOptimizationPasses() {
void AMDGPUPassConfig::addIRPasses() {
const AMDGPUTargetMachine &TM = getAMDGPUTargetMachine();
+ Triple::ArchType Arch = TM.getTargetTriple().getArch();
+ if (RemoveIncompatibleFunctions && Arch == Triple::amdgcn)
+ addPass(createAMDGPURemoveIncompatibleFunctionsPass(&TM));
+
// There is no reason to run these.
disablePass(&StackMapLivenessID);
disablePass(&FuncletLayoutID);
@@ -980,7 +984,7 @@ void AMDGPUPassConfig::addIRPasses() {
addPass(createAlwaysInlinerLegacyPass());
// Handle uses of OpenCL image2d_t, image3d_t and sampler_t arguments.
- if (TM.getTargetTriple().getArch() == Triple::r600)
+ if (Arch == Triple::r600)
addPass(createR600OpenCLImageTypeLoweringPass());
// Replace OpenCL enqueued block function pointers with global variables.
@@ -1049,9 +1053,6 @@ void AMDGPUPassConfig::addIRPasses() {
void AMDGPUPassConfig::addCodeGenPrepare() {
if (TM->getTargetTriple().getArch() == Triple::amdgcn) {
- if (RemoveIncompatibleFunctions)
- addPass(createAMDGPURemoveIncompatibleFunctionsPass(TM));
-
// FIXME: This pass adds 2 hacky attributes that can be replaced with an
// analysis, and should be removed.
addPass(createAMDGPUAnnotateKernelFeaturesPass());
diff --git a/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll b/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
index 63821c01e5b3c5..e7d8c282c0a63f 100644
--- a/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
+++ b/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
@@ -28,6 +28,7 @@
; GCN-O0-NEXT: FunctionPass Manager
; GCN-O0-NEXT: Expand large div/rem
; GCN-O0-NEXT: Expand large fp convert
+; GCN-O0-NEXT: AMDGPU Remove Incompatible Functions
; GCN-O0-NEXT: AMDGPU Printf lowering
; GCN-O0-NEXT: Lower ctors and dtors for AMDGPU
; GCN-O0-NEXT: AMDGPU Inline All Functions
@@ -45,7 +46,6 @@
; GCN-O0-NEXT: Expand vector predication intrinsics
; GCN-O0-NEXT: Scalarize Masked Memory Intrinsics
; GCN-O0-NEXT: Expand reduction intrinsics
-; GCN-O0-NEXT: AMDGPU Remove Incompatible Functions
; GCN-O0-NEXT: CallGraph Construction
; GCN-O0-NEXT: Call Graph SCC Pass Manager
; GCN-O0-NEXT: AMDGPU Annotate Kernel Features
@@ -169,6 +169,7 @@
; GCN-O1-NEXT: FunctionPass Manager
; GCN-O1-NEXT: Expand large div/rem
; GCN-O1-NEXT: Expand large fp convert
+; GCN-O1-NEXT: AMDGPU Remove Incompatible Functions
; GCN-O1-NEXT: AMDGPU Printf lowering
; GCN-O1-NEXT: Lower ctors and dtors for AMDGPU
; GCN-O1-NEXT: AMDGPU Inline All Functions
@@ -220,7 +221,6 @@
; GCN-O1-NEXT: Expand reduction intrinsics
; GCN-O1-NEXT: Natural Loop Information
; GCN-O1-NEXT: TLS Variable Hoist
-; GCN-O1-NEXT: AMDGPU Remove Incompatible Functions
; GCN-O1-NEXT: CallGraph Construction
; GCN-O1-NEXT: Call Graph SCC Pass Manager
; GCN-O1-NEXT: AMDGPU Annotate Kernel Features
@@ -440,6 +440,7 @@
; GCN-O1-OPTS-NEXT: FunctionPass Manager
; GCN-O1-OPTS-NEXT: Expand large div/rem
; GCN-O1-OPTS-NEXT: Expand large fp convert
+; GCN-O1-OPTS-NEXT: AMDGPU Remove Incompatible Functions
; GCN-O1-OPTS-NEXT: AMDGPU Printf lowering
; GCN-O1-OPTS-NEXT: Lower ctors and dtors for AMDGPU
; GCN-O1-OPTS-NEXT: AMDGPU Inline All Functions
@@ -499,7 +500,6 @@
; GCN-O1-OPTS-NEXT: Natural Loop Information
; GCN-O1-OPTS-NEXT: TLS Variable Hoist
; GCN-O1-OPTS-NEXT: Early CSE
-; GCN-O1-OPTS-NEXT: AMDGPU Remove Incompatible Functions
; GCN-O1-OPTS-NEXT: CallGraph Construction
; GCN-O1-OPTS-NEXT: Call Graph SCC Pass Manager
; GCN-O1-OPTS-NEXT: AMDGPU Annotate Kernel Features
@@ -733,6 +733,7 @@
; GCN-O2-NEXT: FunctionPass Manager
; GCN-O2-NEXT: Expand large div/rem
; GCN-O2-NEXT: Expand large fp convert
+; GCN-O2-NEXT: AMDGPU Remove Incompatible Functions
; GCN-O2-NEXT: AMDGPU Printf lowering
; GCN-O2-NEXT: Lower ctors and dtors for AMDGPU
; GCN-O2-NEXT: AMDGPU Inline All Functions
@@ -800,7 +801,6 @@
; GCN-O2-NEXT: Natural Loop Information
; GCN-O2-NEXT: TLS Variable Hoist
; GCN-O2-NEXT: Early CSE
-; GCN-O2-NEXT: AMDGPU Remove Incompatible Functions
; GCN-O2-NEXT: CallGraph Construction
; GCN-O2-NEXT: Call Graph SCC Pass Manager
; GCN-O2-NEXT: AMDGPU Annotate Kernel Features
@@ -1036,6 +1036,7 @@
; GCN-O3-NEXT: FunctionPass Manager
; GCN-O3-NEXT: Expand large div/rem
; GCN-O3-NEXT: Expand large fp convert
+; GCN-O3-NEXT: AMDGPU Remove Incompatible Functions
; GCN-O3-NEXT: AMDGPU Printf lowering
; GCN-O3-NEXT: Lower ctors and dtors for AMDGPU
; GCN-O3-NEXT: AMDGPU Inline All Functions
@@ -1115,7 +1116,6 @@
; GCN-O3-NEXT: Lazy Block Frequency Analysis
; GCN-O3-NEXT: Optimization Remark Emitter
; GCN-O3-NEXT: Global Value Numbering
-; GCN-O3-NEXT: AMDGPU Remove Incompatible Functions
; GCN-O3-NEXT: CallGraph Construction
; GCN-O3-NEXT: Call Graph SCC Pass Manager
; GCN-O3-NEXT: AMDGPU Annotate Kernel Features
More information about the llvm-commits
mailing list