Revert "[DA][TTI][AMDGPU] Add option to select GPUDA with TTI"
authorNico Weber <thakis@chromium.org>
Wed, 22 Jan 2020 17:56:19 +0000 (12:56 -0500)
committerNico Weber <thakis@chromium.org>
Wed, 22 Jan 2020 17:56:19 +0000 (12:56 -0500)
This reverts commit a90a6502ab35d3c15c7d56772e409c5632ce6cfb.
Broke tests on Windows: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/13808

llvm/include/llvm/Analysis/LegacyDivergenceAnalysis.h
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/lib/Analysis/LegacyDivergenceAnalysis.cpp
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h

index 0335599a976e421a1be2d8d647114bab5112637e..0770093bcd48a0538abd6e9da016ee0208a8b137 100644 (file)
@@ -54,8 +54,7 @@ public:
 
 private:
   // Whether analysis should be performed by GPUDivergenceAnalysis.
-  bool shouldUseGPUDivergenceAnalysis(const Function &F,
-                                      const TargetTransformInfo &TTI) const;
+  bool shouldUseGPUDivergenceAnalysis(const Function &F) const;
 
   // (optional) handle to new DivergenceAnalysis
   std::unique_ptr<GPUDivergenceAnalysis> gpuDA;
index 8a1e720d77f6bbd94af8176b83660c903f22c548..5382d76813a7158cbbce41d1c4c4398e285f5118 100644 (file)
@@ -342,10 +342,6 @@ public:
   /// branches.
   bool hasBranchDivergence() const;
 
-  /// Return true if the target prefers to use GPU divergence analysis to
-  /// replace the legacy version.
-  bool useGPUDivergenceAnalysis() const;
-
   /// Returns whether V is a source of divergence.
   ///
   /// This function provides the target-dependent information for
@@ -1202,7 +1198,6 @@ public:
   virtual int
   getUserCost(const User *U, ArrayRef<const Value *> Operands) = 0;
   virtual bool hasBranchDivergence() = 0;
-  virtual bool useGPUDivergenceAnalysis() = 0;
   virtual bool isSourceOfDivergence(const Value *V) = 0;
   virtual bool isAlwaysUniform(const Value *V) = 0;
   virtual unsigned getFlatAddressSpace() = 0;
@@ -1457,7 +1452,6 @@ public:
     return Impl.getUserCost(U, Operands);
   }
   bool hasBranchDivergence() override { return Impl.hasBranchDivergence(); }
-  bool useGPUDivergenceAnalysis() override { return Impl.useGPUDivergenceAnalysis(); }
   bool isSourceOfDivergence(const Value *V) override {
     return Impl.isSourceOfDivergence(V);
   }
index eb35f4570347658a7d252afc98d28602b9d8b6e6..ac0609e29270ee13b09dd3c8fc7b30608c301e18 100644 (file)
@@ -152,8 +152,6 @@ public:
 
   bool hasBranchDivergence() { return false; }
 
-  bool useGPUDivergenceAnalysis() { return false; }
-
   bool isSourceOfDivergence(const Value *V) { return false; }
 
   bool isAlwaysUniform(const Value *V) { return false; }
index f0145387c5e1ed431137b51a1ddcd52a662e8d15..30533d90bbf7f637c4b916e3df3068e65c091f09 100644 (file)
@@ -207,8 +207,6 @@ public:
 
   bool hasBranchDivergence() { return false; }
 
-  bool useGPUDivergenceAnalysis() { return false; }
-
   bool isSourceOfDivergence(const Value *V) { return false; }
 
   bool isAlwaysUniform(const Value *V) { return false; }
index 10ead1019206038ef29402a3f5a7b820b248df02..0f274429f11fd76210ae10f7c61a1051cb19fb86 100644 (file)
@@ -301,13 +301,14 @@ FunctionPass *llvm::createLegacyDivergenceAnalysisPass() {
 void LegacyDivergenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addRequired<DominatorTreeWrapperPass>();
   AU.addRequired<PostDominatorTreeWrapperPass>();
-  AU.addRequired<LoopInfoWrapperPass>();
+  if (UseGPUDA)
+    AU.addRequired<LoopInfoWrapperPass>();
   AU.setPreservesAll();
 }
 
 bool LegacyDivergenceAnalysis::shouldUseGPUDivergenceAnalysis(
-    const Function &F, const TargetTransformInfo &TTI) const {
-  if (!(UseGPUDA || TTI.useGPUDivergenceAnalysis()))
+    const Function &F) const {
+  if (!UseGPUDA)
     return false;
 
   // GPUDivergenceAnalysis requires a reducible CFG.
@@ -336,7 +337,7 @@ bool LegacyDivergenceAnalysis::runOnFunction(Function &F) {
   auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
   auto &PDT = getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree();
 
-  if (shouldUseGPUDivergenceAnalysis(F, TTI)) {
+  if (shouldUseGPUDivergenceAnalysis(F)) {
     // run the new GPU divergence analysis
     auto &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
     gpuDA = std::make_unique<GPUDivergenceAnalysis>(F, DT, PDT, LI, TTI);
index 62c021435b33c3098f1dcc4dd8fbdb68938f0beb..f2c63f789d89215a1b2e11727e5799fee1084856 100644 (file)
@@ -212,10 +212,6 @@ bool TargetTransformInfo::hasBranchDivergence() const {
   return TTIImpl->hasBranchDivergence();
 }
 
-bool TargetTransformInfo::useGPUDivergenceAnalysis() const {
-  return TTIImpl->useGPUDivergenceAnalysis();
-}
-
 bool TargetTransformInfo::isSourceOfDivergence(const Value *V) const {
   return TTIImpl->isSourceOfDivergence(V);
 }
index a255a49b26b635b8f9919a70f8c7159257868aa8..c4eeb81c5133e21062c8c9948aa61880ddd36fd2 100644 (file)
@@ -69,11 +69,6 @@ static cl::opt<unsigned> UnrollThresholdIf(
   cl::desc("Unroll threshold increment for AMDGPU for each if statement inside loop"),
   cl::init(150), cl::Hidden);
 
-static cl::opt<bool> UseLegacyDA(
-  "amdgpu-use-legacy-divergence-analysis",
-  cl::desc("Enable legacy divergence analysis for AMDGPU"),
-  cl::init(false), cl::Hidden);
-
 static bool dependsOnLocalPhi(const Loop *L, const Value *Cond,
                               unsigned Depth = 0) {
   const Instruction *I = dyn_cast<Instruction>(Cond);
@@ -606,11 +601,6 @@ static bool isArgPassedInSGPR(const Argument *A) {
   }
 }
 
-/// \returns true if the new GPU divergence analysis is enabled.
-bool GCNTTIImpl::useGPUDivergenceAnalysis() const {
-  return !UseLegacyDA;
-}
-
 /// \returns true if the result of the value could potentially be
 /// different across workitems in a wavefront.
 bool GCNTTIImpl::isSourceOfDivergence(const Value *V) const {
index 7dd692be5530f726b71915426b3ee2d54ce8bf2b..0b48f9f602b7130a468be089b7288b12c91e684a 100644 (file)
@@ -136,7 +136,6 @@ public:
       HasFP32Denormals(ST->hasFP32Denormals(F)) { }
 
   bool hasBranchDivergence() { return true; }
-  bool useGPUDivergenceAnalysis() const;
 
   void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
                                TTI::UnrollingPreferences &UP);