Skip to content

Commit cd47071

Browse files
committed
Revert "[DA][TTI][AMDGPU] Add option to select GPUDA with TTI"
This reverts commit a90a650. Broke tests on Windows: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/13808
1 parent bfcfa53 commit cd47071

File tree

8 files changed

+6
-31
lines changed

8 files changed

+6
-31
lines changed

llvm/include/llvm/Analysis/LegacyDivergenceAnalysis.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ class LegacyDivergenceAnalysis : public FunctionPass {
5454

5555
private:
5656
// Whether analysis should be performed by GPUDivergenceAnalysis.
57-
bool shouldUseGPUDivergenceAnalysis(const Function &F,
58-
const TargetTransformInfo &TTI) const;
57+
bool shouldUseGPUDivergenceAnalysis(const Function &F) const;
5958

6059
// (optional) handle to new DivergenceAnalysis
6160
std::unique_ptr<GPUDivergenceAnalysis> gpuDA;

llvm/include/llvm/Analysis/TargetTransformInfo.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,6 @@ class TargetTransformInfo {
342342
/// branches.
343343
bool hasBranchDivergence() const;
344344

345-
/// Return true if the target prefers to use GPU divergence analysis to
346-
/// replace the legacy version.
347-
bool useGPUDivergenceAnalysis() const;
348-
349345
/// Returns whether V is a source of divergence.
350346
///
351347
/// This function provides the target-dependent information for
@@ -1202,7 +1198,6 @@ class TargetTransformInfo::Concept {
12021198
virtual int
12031199
getUserCost(const User *U, ArrayRef<const Value *> Operands) = 0;
12041200
virtual bool hasBranchDivergence() = 0;
1205-
virtual bool useGPUDivergenceAnalysis() = 0;
12061201
virtual bool isSourceOfDivergence(const Value *V) = 0;
12071202
virtual bool isAlwaysUniform(const Value *V) = 0;
12081203
virtual unsigned getFlatAddressSpace() = 0;
@@ -1457,7 +1452,6 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
14571452
return Impl.getUserCost(U, Operands);
14581453
}
14591454
bool hasBranchDivergence() override { return Impl.hasBranchDivergence(); }
1460-
bool useGPUDivergenceAnalysis() override { return Impl.useGPUDivergenceAnalysis(); }
14611455
bool isSourceOfDivergence(const Value *V) override {
14621456
return Impl.isSourceOfDivergence(V);
14631457
}

llvm/include/llvm/Analysis/TargetTransformInfoImpl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ class TargetTransformInfoImplBase {
152152

153153
bool hasBranchDivergence() { return false; }
154154

155-
bool useGPUDivergenceAnalysis() { return false; }
156-
157155
bool isSourceOfDivergence(const Value *V) { return false; }
158156

159157
bool isAlwaysUniform(const Value *V) { return false; }

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,6 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
207207

208208
bool hasBranchDivergence() { return false; }
209209

210-
bool useGPUDivergenceAnalysis() { return false; }
211-
212210
bool isSourceOfDivergence(const Value *V) { return false; }
213211

214212
bool isAlwaysUniform(const Value *V) { return false; }

llvm/lib/Analysis/LegacyDivergenceAnalysis.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,14 @@ FunctionPass *llvm::createLegacyDivergenceAnalysisPass() {
301301
void LegacyDivergenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
302302
AU.addRequired<DominatorTreeWrapperPass>();
303303
AU.addRequired<PostDominatorTreeWrapperPass>();
304-
AU.addRequired<LoopInfoWrapperPass>();
304+
if (UseGPUDA)
305+
AU.addRequired<LoopInfoWrapperPass>();
305306
AU.setPreservesAll();
306307
}
307308

308309
bool LegacyDivergenceAnalysis::shouldUseGPUDivergenceAnalysis(
309-
const Function &F, const TargetTransformInfo &TTI) const {
310-
if (!(UseGPUDA || TTI.useGPUDivergenceAnalysis()))
310+
const Function &F) const {
311+
if (!UseGPUDA)
311312
return false;
312313

313314
// GPUDivergenceAnalysis requires a reducible CFG.
@@ -336,7 +337,7 @@ bool LegacyDivergenceAnalysis::runOnFunction(Function &F) {
336337
auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
337338
auto &PDT = getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree();
338339

339-
if (shouldUseGPUDivergenceAnalysis(F, TTI)) {
340+
if (shouldUseGPUDivergenceAnalysis(F)) {
340341
// run the new GPU divergence analysis
341342
auto &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
342343
gpuDA = std::make_unique<GPUDivergenceAnalysis>(F, DT, PDT, LI, TTI);

llvm/lib/Analysis/TargetTransformInfo.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,6 @@ bool TargetTransformInfo::hasBranchDivergence() const {
212212
return TTIImpl->hasBranchDivergence();
213213
}
214214

215-
bool TargetTransformInfo::useGPUDivergenceAnalysis() const {
216-
return TTIImpl->useGPUDivergenceAnalysis();
217-
}
218-
219215
bool TargetTransformInfo::isSourceOfDivergence(const Value *V) const {
220216
return TTIImpl->isSourceOfDivergence(V);
221217
}

llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ static cl::opt<unsigned> UnrollThresholdIf(
6969
cl::desc("Unroll threshold increment for AMDGPU for each if statement inside loop"),
7070
cl::init(150), cl::Hidden);
7171

72-
static cl::opt<bool> UseLegacyDA(
73-
"amdgpu-use-legacy-divergence-analysis",
74-
cl::desc("Enable legacy divergence analysis for AMDGPU"),
75-
cl::init(false), cl::Hidden);
76-
7772
static bool dependsOnLocalPhi(const Loop *L, const Value *Cond,
7873
unsigned Depth = 0) {
7974
const Instruction *I = dyn_cast<Instruction>(Cond);
@@ -606,11 +601,6 @@ static bool isArgPassedInSGPR(const Argument *A) {
606601
}
607602
}
608603

609-
/// \returns true if the new GPU divergence analysis is enabled.
610-
bool GCNTTIImpl::useGPUDivergenceAnalysis() const {
611-
return !UseLegacyDA;
612-
}
613-
614604
/// \returns true if the result of the value could potentially be
615605
/// different across workitems in a wavefront.
616606
bool GCNTTIImpl::isSourceOfDivergence(const Value *V) const {

llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
136136
HasFP32Denormals(ST->hasFP32Denormals(F)) { }
137137

138138
bool hasBranchDivergence() { return true; }
139-
bool useGPUDivergenceAnalysis() const;
140139

141140
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
142141
TTI::UnrollingPreferences &UP);

0 commit comments

Comments
 (0)