Skip to content

Commit 7474cd3

Browse files
committed
[SIAnnotateControlFlow] Use Uniformity analysis
Reviewed By: foad Differential Revision: https://reviews.llvm.org/D145013
1 parent 1b52c7b commit 7474cd3

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
#include "AMDGPU.h"
1515
#include "GCNSubtarget.h"
16-
#include "llvm/Analysis/LegacyDivergenceAnalysis.h"
1716
#include "llvm/Analysis/LoopInfo.h"
17+
#include "llvm/Analysis/UniformityAnalysis.h"
1818
#include "llvm/CodeGen/TargetPassConfig.h"
1919
#include "llvm/IR/BasicBlock.h"
2020
#include "llvm/IR/Constants.h"
@@ -36,7 +36,7 @@ using StackEntry = std::pair<BasicBlock *, Value *>;
3636
using StackVector = SmallVector<StackEntry, 16>;
3737

3838
class SIAnnotateControlFlow : public FunctionPass {
39-
LegacyDivergenceAnalysis *DA;
39+
UniformityInfo *UA;
4040

4141
Type *Boolean;
4242
Type *Void;
@@ -99,7 +99,7 @@ class SIAnnotateControlFlow : public FunctionPass {
9999
void getAnalysisUsage(AnalysisUsage &AU) const override {
100100
AU.addRequired<LoopInfoWrapperPass>();
101101
AU.addRequired<DominatorTreeWrapperPass>();
102-
AU.addRequired<LegacyDivergenceAnalysis>();
102+
AU.addRequired<UniformityInfoWrapperPass>();
103103
AU.addPreserved<LoopInfoWrapperPass>();
104104
AU.addPreserved<DominatorTreeWrapperPass>();
105105
AU.addRequired<TargetPassConfig>();
@@ -112,7 +112,7 @@ class SIAnnotateControlFlow : public FunctionPass {
112112
INITIALIZE_PASS_BEGIN(SIAnnotateControlFlow, DEBUG_TYPE,
113113
"Annotate SI Control Flow", false, false)
114114
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
115-
INITIALIZE_PASS_DEPENDENCY(LegacyDivergenceAnalysis)
115+
INITIALIZE_PASS_DEPENDENCY(UniformityInfoWrapperPass)
116116
INITIALIZE_PASS_DEPENDENCY(TargetPassConfig)
117117
INITIALIZE_PASS_END(SIAnnotateControlFlow, DEBUG_TYPE,
118118
"Annotate SI Control Flow", false, false)
@@ -146,7 +146,7 @@ void SIAnnotateControlFlow::initialize(Module &M, const GCNSubtarget &ST) {
146146
/// Is the branch condition uniform or did the StructurizeCFG pass
147147
/// consider it as such?
148148
bool SIAnnotateControlFlow::isUniform(BranchInst *T) {
149-
return DA->isUniform(T) ||
149+
return UA->isUniform(T) ||
150150
T->getMetadata("structurizecfg.uniform") != nullptr;
151151
}
152152

@@ -336,7 +336,7 @@ bool SIAnnotateControlFlow::closeControlFlow(BasicBlock *BB) {
336336
bool SIAnnotateControlFlow::runOnFunction(Function &F) {
337337
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
338338
LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
339-
DA = &getAnalysis<LegacyDivergenceAnalysis>();
339+
UA = &getAnalysis<UniformityInfoWrapperPass>().getUniformityInfo();
340340
TargetPassConfig &TPC = getAnalysis<TargetPassConfig>();
341341
const TargetMachine &TM = TPC.getTM<TargetMachine>();
342342

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@
8686
; GCN-O0-NEXT: Memory SSA
8787
; GCN-O0-NEXT: AMDGPU Annotate Uniform Values
8888
; GCN-O0-NEXT: Natural Loop Information
89-
; GCN-O0-NEXT: Post-Dominator Tree Construction
90-
; GCN-O0-NEXT: Legacy Divergence Analysis
9189
; GCN-O0-NEXT: SI annotate control flow
9290
; GCN-O0-NEXT: Post-Dominator Tree Construction
9391
; GCN-O0-NEXT: Legacy Divergence Analysis
@@ -283,8 +281,6 @@
283281
; GCN-O1-NEXT: Memory SSA
284282
; GCN-O1-NEXT: AMDGPU Annotate Uniform Values
285283
; GCN-O1-NEXT: Natural Loop Information
286-
; GCN-O1-NEXT: Post-Dominator Tree Construction
287-
; GCN-O1-NEXT: Legacy Divergence Analysis
288284
; GCN-O1-NEXT: SI annotate control flow
289285
; GCN-O1-NEXT: Post-Dominator Tree Construction
290286
; GCN-O1-NEXT: Legacy Divergence Analysis
@@ -584,8 +580,6 @@
584580
; GCN-O1-OPTS-NEXT: Memory SSA
585581
; GCN-O1-OPTS-NEXT: AMDGPU Annotate Uniform Values
586582
; GCN-O1-OPTS-NEXT: Natural Loop Information
587-
; GCN-O1-OPTS-NEXT: Post-Dominator Tree Construction
588-
; GCN-O1-OPTS-NEXT: Legacy Divergence Analysis
589583
; GCN-O1-OPTS-NEXT: SI annotate control flow
590584
; GCN-O1-OPTS-NEXT: Post-Dominator Tree Construction
591585
; GCN-O1-OPTS-NEXT: Legacy Divergence Analysis
@@ -893,8 +887,6 @@
893887
; GCN-O2-NEXT: Memory SSA
894888
; GCN-O2-NEXT: AMDGPU Annotate Uniform Values
895889
; GCN-O2-NEXT: Natural Loop Information
896-
; GCN-O2-NEXT: Post-Dominator Tree Construction
897-
; GCN-O2-NEXT: Legacy Divergence Analysis
898890
; GCN-O2-NEXT: SI annotate control flow
899891
; GCN-O2-NEXT: Post-Dominator Tree Construction
900892
; GCN-O2-NEXT: Legacy Divergence Analysis
@@ -1215,8 +1207,6 @@
12151207
; GCN-O3-NEXT: Memory SSA
12161208
; GCN-O3-NEXT: AMDGPU Annotate Uniform Values
12171209
; GCN-O3-NEXT: Natural Loop Information
1218-
; GCN-O3-NEXT: Post-Dominator Tree Construction
1219-
; GCN-O3-NEXT: Legacy Divergence Analysis
12201210
; GCN-O3-NEXT: SI annotate control flow
12211211
; GCN-O3-NEXT: Post-Dominator Tree Construction
12221212
; GCN-O3-NEXT: Legacy Divergence Analysis

0 commit comments

Comments
 (0)