Skip to content

Commit b4edfc1

Browse files
authored
[LTO] Run ObjCARCContractPass according to the callgraph (#103034)
This matches other IR codegen passes and avoids a Dominator Tree Construction in AMDGPU O2/O3 builds.
1 parent 2256d00 commit b4edfc1

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

llvm/lib/CodeGen/TargetPassConfig.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -944,13 +944,13 @@ void TargetPassConfig::addCodeGenPrepare() {
944944
void TargetPassConfig::addISelPrepare() {
945945
addPreISel();
946946

947-
if (getOptLevel() != CodeGenOptLevel::None)
948-
addPass(createObjCARCContractPass());
949-
950947
// Force codegen to run according to the callgraph.
951948
if (requiresCodeGenSCCOrder())
952949
addPass(new DummyCGSCCPass);
953950

951+
if (getOptLevel() != CodeGenOptLevel::None)
952+
addPass(createObjCARCContractPass());
953+
954954
addPass(createCallBrPass());
955955

956956
// Add both the safe stack and the stack protection passes: each of them will

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,15 @@
279279
; GCN-O1-NEXT: AMDGPU Rewrite Undef for PHI
280280
; GCN-O1-NEXT: LCSSA Verifier
281281
; GCN-O1-NEXT: Loop-Closed SSA Form Pass
282+
; GCN-O1-NEXT: DummyCGSCCPass
283+
; GCN-O1-NEXT: FunctionPass Manager
284+
; GCN-O1-NEXT: Dominator Tree Construction
282285
; GCN-O1-NEXT: Basic Alias Analysis (stateless AA impl)
283286
; GCN-O1-NEXT: Function Alias Analysis Results
284287
; GCN-O1-NEXT: ObjC ARC contraction
285-
; GCN-O1-NEXT: DummyCGSCCPass
286-
; GCN-O1-NEXT: FunctionPass Manager
287288
; GCN-O1-NEXT: Prepare callbr
288289
; GCN-O1-NEXT: Safe Stack instrumentation pass
289290
; GCN-O1-NEXT: Insert stack protectors
290-
; GCN-O1-NEXT: Dominator Tree Construction
291291
; GCN-O1-NEXT: Cycle Info Analysis
292292
; GCN-O1-NEXT: Uniformity Analysis
293293
; GCN-O1-NEXT: Basic Alias Analysis (stateless AA impl)
@@ -574,15 +574,15 @@
574574
; GCN-O1-OPTS-NEXT: AMDGPU Rewrite Undef for PHI
575575
; GCN-O1-OPTS-NEXT: LCSSA Verifier
576576
; GCN-O1-OPTS-NEXT: Loop-Closed SSA Form Pass
577+
; GCN-O1-OPTS-NEXT: DummyCGSCCPass
578+
; GCN-O1-OPTS-NEXT: FunctionPass Manager
579+
; GCN-O1-OPTS-NEXT: Dominator Tree Construction
577580
; GCN-O1-OPTS-NEXT: Basic Alias Analysis (stateless AA impl)
578581
; GCN-O1-OPTS-NEXT: Function Alias Analysis Results
579582
; GCN-O1-OPTS-NEXT: ObjC ARC contraction
580-
; GCN-O1-OPTS-NEXT: DummyCGSCCPass
581-
; GCN-O1-OPTS-NEXT: FunctionPass Manager
582583
; GCN-O1-OPTS-NEXT: Prepare callbr
583584
; GCN-O1-OPTS-NEXT: Safe Stack instrumentation pass
584585
; GCN-O1-OPTS-NEXT: Insert stack protectors
585-
; GCN-O1-OPTS-NEXT: Dominator Tree Construction
586586
; GCN-O1-OPTS-NEXT: Cycle Info Analysis
587587
; GCN-O1-OPTS-NEXT: Uniformity Analysis
588588
; GCN-O1-OPTS-NEXT: Basic Alias Analysis (stateless AA impl)
@@ -882,17 +882,15 @@
882882
; GCN-O2-NEXT: LCSSA Verifier
883883
; GCN-O2-NEXT: Loop-Closed SSA Form Pass
884884
; GCN-O2-NEXT: Analysis if a function is memory bound
885+
; GCN-O2-NEXT: DummyCGSCCPass
885886
; GCN-O2-NEXT: FunctionPass Manager
886887
; GCN-O2-NEXT: Dominator Tree Construction
887888
; GCN-O2-NEXT: Basic Alias Analysis (stateless AA impl)
888889
; GCN-O2-NEXT: Function Alias Analysis Results
889890
; GCN-O2-NEXT: ObjC ARC contraction
890-
; GCN-O2-NEXT: DummyCGSCCPass
891-
; GCN-O2-NEXT: FunctionPass Manager
892891
; GCN-O2-NEXT: Prepare callbr
893892
; GCN-O2-NEXT: Safe Stack instrumentation pass
894893
; GCN-O2-NEXT: Insert stack protectors
895-
; GCN-O2-NEXT: Dominator Tree Construction
896894
; GCN-O2-NEXT: Cycle Info Analysis
897895
; GCN-O2-NEXT: Uniformity Analysis
898896
; GCN-O2-NEXT: Basic Alias Analysis (stateless AA impl)
@@ -1205,17 +1203,15 @@
12051203
; GCN-O3-NEXT: LCSSA Verifier
12061204
; GCN-O3-NEXT: Loop-Closed SSA Form Pass
12071205
; GCN-O3-NEXT: Analysis if a function is memory bound
1206+
; GCN-O3-NEXT: DummyCGSCCPass
12081207
; GCN-O3-NEXT: FunctionPass Manager
12091208
; GCN-O3-NEXT: Dominator Tree Construction
12101209
; GCN-O3-NEXT: Basic Alias Analysis (stateless AA impl)
12111210
; GCN-O3-NEXT: Function Alias Analysis Results
12121211
; GCN-O3-NEXT: ObjC ARC contraction
1213-
; GCN-O3-NEXT: DummyCGSCCPass
1214-
; GCN-O3-NEXT: FunctionPass Manager
12151212
; GCN-O3-NEXT: Prepare callbr
12161213
; GCN-O3-NEXT: Safe Stack instrumentation pass
12171214
; GCN-O3-NEXT: Insert stack protectors
1218-
; GCN-O3-NEXT: Dominator Tree Construction
12191215
; GCN-O3-NEXT: Cycle Info Analysis
12201216
; GCN-O3-NEXT: Uniformity Analysis
12211217
; GCN-O3-NEXT: Basic Alias Analysis (stateless AA impl)

0 commit comments

Comments
 (0)