Skip to content

Commit 58e7ec4

Browse files
committed
[AMDGPU] Run SIShrinkInstructions before post-RA scheduling
Run post-RA SIShrinkInstructions just before post-RA scheduling, instead of afterwards. After the fixes in D112305 and D112317 this seems to make no difference, but it paves the way for scheduler tweaks that are sensitive to the e32 vs e64 encoding of VALU instructions. Differential Revision: https://reviews.llvm.org/D112341
1 parent 42e4959 commit 58e7ec4

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,16 +1327,15 @@ void GCNPassConfig::addPostRegAlloc() {
13271327
}
13281328

13291329
void GCNPassConfig::addPreSched2() {
1330+
if (TM->getOptLevel() > CodeGenOpt::None)
1331+
addPass(createSIShrinkInstructionsPass());
13301332
addPass(&SIPostRABundlerID);
13311333
}
13321334

13331335
void GCNPassConfig::addPreEmitPass() {
13341336
addPass(createSIMemoryLegalizerPass());
13351337
addPass(createSIInsertWaitcntsPass());
13361338

1337-
if (TM->getOptLevel() > CodeGenOpt::None)
1338-
addPass(createSIShrinkInstructionsPass());
1339-
13401339
addPass(createSIModeRegisterPass());
13411340

13421341
if (getOptLevel() > CodeGenOpt::None)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@
367367
; GCN-O1-NEXT: Tail Duplication
368368
; GCN-O1-NEXT: Machine Copy Propagation Pass
369369
; GCN-O1-NEXT: Post-RA pseudo instruction expansion pass
370+
; GCN-O1-NEXT: SI Shrink Instructions
370371
; GCN-O1-NEXT: SI post-RA bundler
371372
; GCN-O1-NEXT: MachineDominator Tree Construction
372373
; GCN-O1-NEXT: Machine Natural Loop Construction
@@ -379,7 +380,6 @@
379380
; GCN-O1-NEXT: SI Memory Legalizer
380381
; GCN-O1-NEXT: MachinePostDominator Tree Construction
381382
; GCN-O1-NEXT: SI insert wait instructions
382-
; GCN-O1-NEXT: SI Shrink Instructions
383383
; GCN-O1-NEXT: Insert required mode register values
384384
; GCN-O1-NEXT: SI Insert Hard Clauses
385385
; GCN-O1-NEXT: MachineDominator Tree Construction
@@ -651,6 +651,7 @@
651651
; GCN-O1-OPTS-NEXT: Tail Duplication
652652
; GCN-O1-OPTS-NEXT: Machine Copy Propagation Pass
653653
; GCN-O1-OPTS-NEXT: Post-RA pseudo instruction expansion pass
654+
; GCN-O1-OPTS-NEXT: SI Shrink Instructions
654655
; GCN-O1-OPTS-NEXT: SI post-RA bundler
655656
; GCN-O1-OPTS-NEXT: MachineDominator Tree Construction
656657
; GCN-O1-OPTS-NEXT: Machine Natural Loop Construction
@@ -663,7 +664,6 @@
663664
; GCN-O1-OPTS-NEXT: SI Memory Legalizer
664665
; GCN-O1-OPTS-NEXT: MachinePostDominator Tree Construction
665666
; GCN-O1-OPTS-NEXT: SI insert wait instructions
666-
; GCN-O1-OPTS-NEXT: SI Shrink Instructions
667667
; GCN-O1-OPTS-NEXT: Insert required mode register values
668668
; GCN-O1-OPTS-NEXT: SI Insert Hard Clauses
669669
; GCN-O1-OPTS-NEXT: MachineDominator Tree Construction
@@ -937,6 +937,7 @@
937937
; GCN-O2-NEXT: Tail Duplication
938938
; GCN-O2-NEXT: Machine Copy Propagation Pass
939939
; GCN-O2-NEXT: Post-RA pseudo instruction expansion pass
940+
; GCN-O2-NEXT: SI Shrink Instructions
940941
; GCN-O2-NEXT: SI post-RA bundler
941942
; GCN-O2-NEXT: MachineDominator Tree Construction
942943
; GCN-O2-NEXT: Machine Natural Loop Construction
@@ -949,7 +950,6 @@
949950
; GCN-O2-NEXT: SI Memory Legalizer
950951
; GCN-O2-NEXT: MachinePostDominator Tree Construction
951952
; GCN-O2-NEXT: SI insert wait instructions
952-
; GCN-O2-NEXT: SI Shrink Instructions
953953
; GCN-O2-NEXT: Insert required mode register values
954954
; GCN-O2-NEXT: SI Insert Hard Clauses
955955
; GCN-O2-NEXT: MachineDominator Tree Construction
@@ -1236,6 +1236,7 @@
12361236
; GCN-O3-NEXT: Tail Duplication
12371237
; GCN-O3-NEXT: Machine Copy Propagation Pass
12381238
; GCN-O3-NEXT: Post-RA pseudo instruction expansion pass
1239+
; GCN-O3-NEXT: SI Shrink Instructions
12391240
; GCN-O3-NEXT: SI post-RA bundler
12401241
; GCN-O3-NEXT: MachineDominator Tree Construction
12411242
; GCN-O3-NEXT: Machine Natural Loop Construction
@@ -1248,7 +1249,6 @@
12481249
; GCN-O3-NEXT: SI Memory Legalizer
12491250
; GCN-O3-NEXT: MachinePostDominator Tree Construction
12501251
; GCN-O3-NEXT: SI insert wait instructions
1251-
; GCN-O3-NEXT: SI Shrink Instructions
12521252
; GCN-O3-NEXT: Insert required mode register values
12531253
; GCN-O3-NEXT: SI Insert Hard Clauses
12541254
; GCN-O3-NEXT: MachineDominator Tree Construction

0 commit comments

Comments
 (0)