Skip to content

Commit 5b5bd81

Browse files
committed
AMDGPU: Move placement of RemoveIncompatibleFunctions
This should be approximately first and run with other module passes. https://reviews.llvm.org/D155987
1 parent db4d6ef commit 5b5bd81

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,10 @@ void AMDGPUPassConfig::addStraightLineScalarOptimizationPasses() {
966966
void AMDGPUPassConfig::addIRPasses() {
967967
const AMDGPUTargetMachine &TM = getAMDGPUTargetMachine();
968968

969+
Triple::ArchType Arch = TM.getTargetTriple().getArch();
970+
if (RemoveIncompatibleFunctions && Arch == Triple::amdgcn)
971+
addPass(createAMDGPURemoveIncompatibleFunctionsPass(&TM));
972+
969973
// There is no reason to run these.
970974
disablePass(&StackMapLivenessID);
971975
disablePass(&FuncletLayoutID);
@@ -980,7 +984,7 @@ void AMDGPUPassConfig::addIRPasses() {
980984
addPass(createAlwaysInlinerLegacyPass());
981985

982986
// Handle uses of OpenCL image2d_t, image3d_t and sampler_t arguments.
983-
if (TM.getTargetTriple().getArch() == Triple::r600)
987+
if (Arch == Triple::r600)
984988
addPass(createR600OpenCLImageTypeLoweringPass());
985989

986990
// Replace OpenCL enqueued block function pointers with global variables.
@@ -1049,9 +1053,6 @@ void AMDGPUPassConfig::addIRPasses() {
10491053

10501054
void AMDGPUPassConfig::addCodeGenPrepare() {
10511055
if (TM->getTargetTriple().getArch() == Triple::amdgcn) {
1052-
if (RemoveIncompatibleFunctions)
1053-
addPass(createAMDGPURemoveIncompatibleFunctionsPass(TM));
1054-
10551056
// FIXME: This pass adds 2 hacky attributes that can be replaced with an
10561057
// analysis, and should be removed.
10571058
addPass(createAMDGPUAnnotateKernelFeaturesPass());

llvm/test/CodeGen/AMDGPU/llc-pipeline.ll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
; GCN-O0-NEXT: FunctionPass Manager
2929
; GCN-O0-NEXT: Expand large div/rem
3030
; GCN-O0-NEXT: Expand large fp convert
31+
; GCN-O0-NEXT: AMDGPU Remove Incompatible Functions
3132
; GCN-O0-NEXT: AMDGPU Printf lowering
3233
; GCN-O0-NEXT: Lower ctors and dtors for AMDGPU
3334
; GCN-O0-NEXT: AMDGPU Inline All Functions
@@ -45,7 +46,6 @@
4546
; GCN-O0-NEXT: Expand vector predication intrinsics
4647
; GCN-O0-NEXT: Scalarize Masked Memory Intrinsics
4748
; GCN-O0-NEXT: Expand reduction intrinsics
48-
; GCN-O0-NEXT: AMDGPU Remove Incompatible Functions
4949
; GCN-O0-NEXT: CallGraph Construction
5050
; GCN-O0-NEXT: Call Graph SCC Pass Manager
5151
; GCN-O0-NEXT: AMDGPU Annotate Kernel Features
@@ -169,6 +169,7 @@
169169
; GCN-O1-NEXT: FunctionPass Manager
170170
; GCN-O1-NEXT: Expand large div/rem
171171
; GCN-O1-NEXT: Expand large fp convert
172+
; GCN-O1-NEXT: AMDGPU Remove Incompatible Functions
172173
; GCN-O1-NEXT: AMDGPU Printf lowering
173174
; GCN-O1-NEXT: Lower ctors and dtors for AMDGPU
174175
; GCN-O1-NEXT: AMDGPU Inline All Functions
@@ -220,7 +221,6 @@
220221
; GCN-O1-NEXT: Expand reduction intrinsics
221222
; GCN-O1-NEXT: Natural Loop Information
222223
; GCN-O1-NEXT: TLS Variable Hoist
223-
; GCN-O1-NEXT: AMDGPU Remove Incompatible Functions
224224
; GCN-O1-NEXT: CallGraph Construction
225225
; GCN-O1-NEXT: Call Graph SCC Pass Manager
226226
; GCN-O1-NEXT: AMDGPU Annotate Kernel Features
@@ -440,6 +440,7 @@
440440
; GCN-O1-OPTS-NEXT: FunctionPass Manager
441441
; GCN-O1-OPTS-NEXT: Expand large div/rem
442442
; GCN-O1-OPTS-NEXT: Expand large fp convert
443+
; GCN-O1-OPTS-NEXT: AMDGPU Remove Incompatible Functions
443444
; GCN-O1-OPTS-NEXT: AMDGPU Printf lowering
444445
; GCN-O1-OPTS-NEXT: Lower ctors and dtors for AMDGPU
445446
; GCN-O1-OPTS-NEXT: AMDGPU Inline All Functions
@@ -499,7 +500,6 @@
499500
; GCN-O1-OPTS-NEXT: Natural Loop Information
500501
; GCN-O1-OPTS-NEXT: TLS Variable Hoist
501502
; GCN-O1-OPTS-NEXT: Early CSE
502-
; GCN-O1-OPTS-NEXT: AMDGPU Remove Incompatible Functions
503503
; GCN-O1-OPTS-NEXT: CallGraph Construction
504504
; GCN-O1-OPTS-NEXT: Call Graph SCC Pass Manager
505505
; GCN-O1-OPTS-NEXT: AMDGPU Annotate Kernel Features
@@ -733,6 +733,7 @@
733733
; GCN-O2-NEXT: FunctionPass Manager
734734
; GCN-O2-NEXT: Expand large div/rem
735735
; GCN-O2-NEXT: Expand large fp convert
736+
; GCN-O2-NEXT: AMDGPU Remove Incompatible Functions
736737
; GCN-O2-NEXT: AMDGPU Printf lowering
737738
; GCN-O2-NEXT: Lower ctors and dtors for AMDGPU
738739
; GCN-O2-NEXT: AMDGPU Inline All Functions
@@ -800,7 +801,6 @@
800801
; GCN-O2-NEXT: Natural Loop Information
801802
; GCN-O2-NEXT: TLS Variable Hoist
802803
; GCN-O2-NEXT: Early CSE
803-
; GCN-O2-NEXT: AMDGPU Remove Incompatible Functions
804804
; GCN-O2-NEXT: CallGraph Construction
805805
; GCN-O2-NEXT: Call Graph SCC Pass Manager
806806
; GCN-O2-NEXT: AMDGPU Annotate Kernel Features
@@ -1036,6 +1036,7 @@
10361036
; GCN-O3-NEXT: FunctionPass Manager
10371037
; GCN-O3-NEXT: Expand large div/rem
10381038
; GCN-O3-NEXT: Expand large fp convert
1039+
; GCN-O3-NEXT: AMDGPU Remove Incompatible Functions
10391040
; GCN-O3-NEXT: AMDGPU Printf lowering
10401041
; GCN-O3-NEXT: Lower ctors and dtors for AMDGPU
10411042
; GCN-O3-NEXT: AMDGPU Inline All Functions
@@ -1115,7 +1116,6 @@
11151116
; GCN-O3-NEXT: Lazy Block Frequency Analysis
11161117
; GCN-O3-NEXT: Optimization Remark Emitter
11171118
; GCN-O3-NEXT: Global Value Numbering
1118-
; GCN-O3-NEXT: AMDGPU Remove Incompatible Functions
11191119
; GCN-O3-NEXT: CallGraph Construction
11201120
; GCN-O3-NEXT: Call Graph SCC Pass Manager
11211121
; GCN-O3-NEXT: AMDGPU Annotate Kernel Features

0 commit comments

Comments
 (0)