[PM/AA] Remove the AliasDebugger pass.
authorChandler Carruth <chandlerc@gmail.com>
Wed, 12 Aug 2015 22:54:47 +0000 (22:54 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 12 Aug 2015 22:54:47 +0000 (22:54 +0000)
This debugger was designed to catch places where the old update API was
failing to be used correctly. As I've removed the update API, it no
longer serves any purpose. We can introduce new debugging aid passes
around any future work w.r.t. updating AAs.

Note that I've updated the documentation here, but really I need to
rewrite the documentation to carefully spell out the ideas around
stateful AA and how things are changing in the AA world. However, I'm
hoping to do that as a follow-up to the refactoring of the AA
infrastructure to work in both old and new pass managers so that I can
write the documentation specific to that world.

Differential Revision: http://reviews.llvm.org/D11984

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244825 91177308-0d34-0410-b5e6-96231b3b80d8

docs/AliasAnalysis.rst
include/llvm/Analysis/Passes.h
include/llvm/InitializePasses.h
include/llvm/LinkAllPasses.h
lib/Analysis/AliasDebugger.cpp [deleted file]
lib/Analysis/Analysis.cpp
lib/Analysis/CMakeLists.txt

index f62cc3fe4d3150895b0b408acfe5d07ebe0761bf..fe7fcbd4bc50f5d181ba06df7a42bad02bdf08b6 100644 (file)
@@ -389,11 +389,10 @@ in its ``getAnalysisUsage`` that it does so. Some passes attempt to use
 ``AU.addPreserved<AliasAnalysis>``, however this doesn't actually have any
 effect.
 
-``AliasAnalysisCounter`` (``-count-aa``) and ``AliasDebugger`` (``-debug-aa``)
-are implemented as ``ModulePass`` classes, so if your alias analysis uses
-``FunctionPass``, it won't be able to use these utilities. If you try to use
-them, the pass manager will silently route alias analysis queries directly to
-``BasicAliasAnalysis`` instead.
+``AliasAnalysisCounter`` (``-count-aa``) are implemented as ``ModulePass``
+classes, so if your alias analysis uses ``FunctionPass``, it won't be able to
+use these utilities. If you try to use them, the pass manager will silently
+route alias analysis queries directly to ``BasicAliasAnalysis`` instead.
 
 Similarly, the ``opt -p`` option introduces ``ModulePass`` passes between each
 pass, which prevents the use of ``FunctionPass`` alias analysis passes.
index 276dd94ad23dd055abba62f363a745e3dfae8dc0..0aa2075154e95312e04a8c735d89bece0cbeb6e9 100644 (file)
@@ -31,12 +31,6 @@ namespace llvm {
   //
   Pass *createGlobalsModRefPass();
 
-  //===--------------------------------------------------------------------===//
-  //
-  // createAliasDebugger - This pass helps debug clients of AA
-  //
-  Pass *createAliasDebugger();
-
   //===--------------------------------------------------------------------===//
   //
   // createAliasAnalysisCounterPass - This pass counts alias queries and how the
index 8c27b34291346e96237ff382175fa2e9c5b7100c..6725eb4c374ebf417d70ba640c09ea585baef8cc 100644 (file)
@@ -68,7 +68,6 @@ void initializeADCEPass(PassRegistry&);
 void initializeBDCEPass(PassRegistry&);
 void initializeAliasAnalysisAnalysisGroup(PassRegistry&);
 void initializeAliasAnalysisCounterPass(PassRegistry&);
-void initializeAliasDebuggerPass(PassRegistry&);
 void initializeAliasSetPrinterPass(PassRegistry&);
 void initializeAlwaysInlinerPass(PassRegistry&);
 void initializeArgPromotionPass(PassRegistry&);
index de3ba1f3829cb4d7054b934cb8d346914677e35b..d8a372e9c80c20d437a139161c73f55b697e87f1 100644 (file)
@@ -54,7 +54,6 @@ namespace {
       (void) llvm::createAggressiveDCEPass();
       (void) llvm::createBitTrackingDCEPass();
       (void) llvm::createAliasAnalysisCounterPass();
-      (void) llvm::createAliasDebugger();
       (void) llvm::createArgumentPromotionPass();
       (void) llvm::createAlignmentFromAssumptionsPass();
       (void) llvm::createBasicAliasAnalysisPass();
diff --git a/lib/Analysis/AliasDebugger.cpp b/lib/Analysis/AliasDebugger.cpp
deleted file mode 100644 (file)
index 146036b..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-//===- AliasDebugger.cpp - Simple Alias Analysis Use Checker --------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This simple pass checks alias analysis users to ensure that if they
-// create a new value, they do not query AA without informing it of the value.
-// It acts as a shim over any other AA pass you want.
-//
-// Yes keeping track of every value in the program is expensive, but this is 
-// a debugging pass.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Analysis/Passes.h"
-#include "llvm/Analysis/AliasAnalysis.h"
-#include "llvm/IR/Constants.h"
-#include "llvm/IR/DerivedTypes.h"
-#include "llvm/IR/Instructions.h"
-#include "llvm/IR/Module.h"
-#include "llvm/Pass.h"
-#include <set>
-using namespace llvm;
-
-namespace {
-  
-  class AliasDebugger : public ModulePass, public AliasAnalysis {
-
-    //What we do is simple.  Keep track of every value the AA could
-    //know about, and verify that queries are one of those.
-    //A query to a value that didn't exist when the AA was created
-    //means someone forgot to update the AA when creating new values
-
-    std::set<const Value*> Vals;
-    
-  public:
-    static char ID; // Class identification, replacement for typeinfo
-    AliasDebugger() : ModulePass(ID) {
-      initializeAliasDebuggerPass(*PassRegistry::getPassRegistry());
-    }
-
-    bool runOnModule(Module &M) override {
-      InitializeAliasAnalysis(this, &M.getDataLayout()); // set up super class
-
-      for(Module::global_iterator I = M.global_begin(),
-            E = M.global_end(); I != E; ++I) {
-        Vals.insert(&*I);
-        for (User::const_op_iterator OI = I->op_begin(),
-             OE = I->op_end(); OI != OE; ++OI)
-          Vals.insert(*OI);
-      }
-
-      for(Module::iterator I = M.begin(),
-            E = M.end(); I != E; ++I){
-        Vals.insert(&*I);
-        if(!I->isDeclaration()) {
-          for (Function::arg_iterator AI = I->arg_begin(), AE = I->arg_end();
-               AI != AE; ++AI) 
-            Vals.insert(&*AI);     
-          for (Function::const_iterator FI = I->begin(), FE = I->end();
-               FI != FE; ++FI) 
-            for (BasicBlock::const_iterator BI = FI->begin(), BE = FI->end();
-                 BI != BE; ++BI) {
-              Vals.insert(&*BI);
-              for (User::const_op_iterator OI = BI->op_begin(),
-                   OE = BI->op_end(); OI != OE; ++OI)
-                Vals.insert(*OI);
-            }
-        }
-        
-      }
-      return false;
-    }
-
-    void getAnalysisUsage(AnalysisUsage &AU) const override {
-      AliasAnalysis::getAnalysisUsage(AU);
-      AU.setPreservesAll();                         // Does not transform code
-    }
-
-    /// getAdjustedAnalysisPointer - This method is used when a pass implements
-    /// an analysis interface through multiple inheritance.  If needed, it
-    /// should override this to adjust the this pointer as needed for the
-    /// specified pass info.
-    void *getAdjustedAnalysisPointer(AnalysisID PI) override {
-      if (PI == &AliasAnalysis::ID)
-        return (AliasAnalysis*)this;
-      return this;
-    }
-    
-    //------------------------------------------------
-    // Implement the AliasAnalysis API
-    //
-    AliasResult alias(const MemoryLocation &LocA,
-                      const MemoryLocation &LocB) override {
-      assert(Vals.find(LocA.Ptr) != Vals.end() &&
-             "Never seen value in AA before");
-      assert(Vals.find(LocB.Ptr) != Vals.end() &&
-             "Never seen value in AA before");
-      return AliasAnalysis::alias(LocA, LocB);
-    }
-
-    ModRefInfo getModRefInfo(ImmutableCallSite CS,
-                             const MemoryLocation &Loc) override {
-      assert(Vals.find(Loc.Ptr) != Vals.end() && "Never seen value in AA before");
-      return AliasAnalysis::getModRefInfo(CS, Loc);
-    }
-
-    ModRefInfo getModRefInfo(ImmutableCallSite CS1,
-                             ImmutableCallSite CS2) override {
-      return AliasAnalysis::getModRefInfo(CS1,CS2);
-    }
-
-    bool pointsToConstantMemory(const MemoryLocation &Loc,
-                                bool OrLocal) override {
-      assert(Vals.find(Loc.Ptr) != Vals.end() && "Never seen value in AA before");
-      return AliasAnalysis::pointsToConstantMemory(Loc, OrLocal);
-    }
-  };
-}
-
-char AliasDebugger::ID = 0;
-INITIALIZE_AG_PASS(AliasDebugger, AliasAnalysis, "debug-aa",
-                   "AA use debugger", false, true, false)
-
-Pass *llvm::createAliasDebugger() { return new AliasDebugger(); }
-
index 3ce87f9a76c28e89806ad3f20bfa0ca2a2b98ba3..ecaac22d9131528ef88589ce36dc8cc49f01002e 100644 (file)
@@ -23,7 +23,6 @@ void llvm::initializeAnalysis(PassRegistry &Registry) {
   initializeAliasAnalysisAnalysisGroup(Registry);
   initializeAliasAnalysisCounterPass(Registry);
   initializeAAEvalPass(Registry);
-  initializeAliasDebuggerPass(Registry);
   initializeAliasSetPrinterPass(Registry);
   initializeNoAAPass(Registry);
   initializeBasicAliasAnalysisPass(Registry);
index 399c0e733b5f8df93f2972d9a779e1c5d1636184..b6aef62eef0c211cd9bc0833bf463c2e54fb9007 100644 (file)
@@ -2,7 +2,6 @@ add_llvm_library(LLVMAnalysis
   AliasAnalysis.cpp
   AliasAnalysisCounter.cpp
   AliasAnalysisEvaluator.cpp
-  AliasDebugger.cpp
   AliasSetTracker.cpp
   Analysis.cpp
   AssumptionCache.cpp