[llvm] r245005 - [PM/AA] Run clang-format over this code to establish a clean baseline

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 19:07:06 PDT 2015


Author: chandlerc
Date: Thu Aug 13 21:07:05 2015
New Revision: 245005

URL: http://llvm.org/viewvc/llvm-project?rev=245005&view=rev
Log:
[PM/AA] Run clang-format over this code to establish a clean baseline
for subsequent changes.

Modified:
    llvm/trunk/include/llvm/Analysis/AliasAnalysisCounter.h
    llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp

Modified: llvm/trunk/include/llvm/Analysis/AliasAnalysisCounter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasAnalysisCounter.h?rev=245005&r1=245004&r2=245005&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasAnalysisCounter.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasAnalysisCounter.h Thu Aug 13 21:07:05 2015
@@ -23,101 +23,100 @@
 
 namespace llvm {
 
-  class AliasAnalysisCounter : public ModulePass, public AliasAnalysis {
-    unsigned No, May, Partial, Must;
-    unsigned NoMR, JustRef, JustMod, MR;
-    Module *M;
-  public:
-    static char ID; // Class identification, replacement for typeinfo
-    AliasAnalysisCounter() : ModulePass(ID) {
-      initializeAliasAnalysisCounterPass(*PassRegistry::getPassRegistry());
-      No = May = Partial = Must = 0;
-      NoMR = JustRef = JustMod = MR = 0;
-    }
-
-    void printLine(const char *Desc, unsigned Val, unsigned Sum) {
-      errs() <<  "  " << Val << " " << Desc << " responses ("
-             << Val*100/Sum << "%)\n";
-    }
-    ~AliasAnalysisCounter() override {
-      unsigned AASum = No+May+Partial+Must;
-      unsigned MRSum = NoMR+JustRef+JustMod+MR;
-      if (AASum + MRSum) { // Print a report if any counted queries occurred...
-        errs() << "\n===== Alias Analysis Counter Report =====\n"
-               << "  Analysis counted:\n"
-               << "  " << AASum << " Total Alias Queries Performed\n";
-        if (AASum) {
-          printLine("no alias",     No, AASum);
-          printLine("may alias",   May, AASum);
-          printLine("partial alias", Partial, AASum);
-          printLine("must alias", Must, AASum);
-          errs() << "  Alias Analysis Counter Summary: " << No*100/AASum << "%/"
-                 << May*100/AASum << "%/"
-                 << Partial*100/AASum << "%/"
-                 << Must*100/AASum<<"%\n\n";
-        }
-
-        errs() << "  " << MRSum << " Total MRI_Mod/MRI_Ref Queries Performed\n";
-        if (MRSum) {
-          printLine("no mod/ref",    NoMR, MRSum);
-          printLine("ref",        JustRef, MRSum);
-          printLine("mod",        JustMod, MRSum);
-          printLine("mod/ref",         MR, MRSum);
-          errs() << "  MRI_Mod/MRI_Ref Analysis Counter Summary: "
-                 << NoMR * 100 / MRSum << "%/" << JustRef * 100 / MRSum << "%/"
-                 << JustMod * 100 / MRSum << "%/" << MR * 100 / MRSum
-                 << "%\n\n";
-        }
+class AliasAnalysisCounter : public ModulePass, public AliasAnalysis {
+  unsigned No, May, Partial, Must;
+  unsigned NoMR, JustRef, JustMod, MR;
+  Module *M;
+
+public:
+  static char ID; // Class identification, replacement for typeinfo
+  AliasAnalysisCounter() : ModulePass(ID) {
+    initializeAliasAnalysisCounterPass(*PassRegistry::getPassRegistry());
+    No = May = Partial = Must = 0;
+    NoMR = JustRef = JustMod = MR = 0;
+  }
+
+  void printLine(const char *Desc, unsigned Val, unsigned Sum) {
+    errs() << "  " << Val << " " << Desc << " responses (" << Val * 100 / Sum
+           << "%)\n";
+  }
+  ~AliasAnalysisCounter() override {
+    unsigned AASum = No + May + Partial + Must;
+    unsigned MRSum = NoMR + JustRef + JustMod + MR;
+    if (AASum + MRSum) { // Print a report if any counted queries occurred...
+      errs() << "\n===== Alias Analysis Counter Report =====\n"
+             << "  Analysis counted:\n"
+             << "  " << AASum << " Total Alias Queries Performed\n";
+      if (AASum) {
+        printLine("no alias", No, AASum);
+        printLine("may alias", May, AASum);
+        printLine("partial alias", Partial, AASum);
+        printLine("must alias", Must, AASum);
+        errs() << "  Alias Analysis Counter Summary: " << No * 100 / AASum
+               << "%/" << May * 100 / AASum << "%/" << Partial * 100 / AASum
+               << "%/" << Must * 100 / AASum << "%\n\n";
       }
-    }
-
-    bool runOnModule(Module &M) override {
-      this->M = &M;
-      InitializeAliasAnalysis(this, &M.getDataLayout());
-      return false;
-    }
 
-    void getAnalysisUsage(AnalysisUsage &AU) const override {
-      AliasAnalysis::getAnalysisUsage(AU);
-      AU.addRequired<AliasAnalysis>();
-      AU.setPreservesAll();
-    }
-
-    /// 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;
-    }
-    
-    // FIXME: We could count these too...
-    bool pointsToConstantMemory(const MemoryLocation &Loc,
-                                bool OrLocal) override {
-      return getAnalysis<AliasAnalysis>().pointsToConstantMemory(Loc, OrLocal);
-    }
-
-    // Forwarding functions: just delegate to a real AA implementation, counting
-    // the number of responses...
-    AliasResult alias(const MemoryLocation &LocA,
-                      const MemoryLocation &LocB) override;
-
-    ModRefInfo getModRefInfo(ImmutableCallSite CS,
-                             const MemoryLocation &Loc) override;
-    ModRefInfo getModRefInfo(ImmutableCallSite CS1,
-                             ImmutableCallSite CS2) override {
-      return AliasAnalysis::getModRefInfo(CS1,CS2);
+      errs() << "  " << MRSum << " Total MRI_Mod/MRI_Ref Queries Performed\n";
+      if (MRSum) {
+        printLine("no mod/ref", NoMR, MRSum);
+        printLine("ref", JustRef, MRSum);
+        printLine("mod", JustMod, MRSum);
+        printLine("mod/ref", MR, MRSum);
+        errs() << "  MRI_Mod/MRI_Ref Analysis Counter Summary: "
+               << NoMR * 100 / MRSum << "%/" << JustRef * 100 / MRSum << "%/"
+               << JustMod * 100 / MRSum << "%/" << MR * 100 / MRSum << "%\n\n";
+      }
     }
-  };
+  }
 
-  //===--------------------------------------------------------------------===//
-  //
-  // createAliasAnalysisCounterPass - This pass counts alias queries and how the
-  // alias analysis implementation responds.
-  //
-  ModulePass *createAliasAnalysisCounterPass();
+  bool runOnModule(Module &M) override {
+    this->M = &M;
+    InitializeAliasAnalysis(this, &M.getDataLayout());
+    return false;
+  }
+
+  void getAnalysisUsage(AnalysisUsage &AU) const override {
+    AliasAnalysis::getAnalysisUsage(AU);
+    AU.addRequired<AliasAnalysis>();
+    AU.setPreservesAll();
+  }
+
+  /// 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;
+  }
+
+  // FIXME: We could count these too...
+  bool pointsToConstantMemory(const MemoryLocation &Loc,
+                              bool OrLocal) override {
+    return getAnalysis<AliasAnalysis>().pointsToConstantMemory(Loc, OrLocal);
+  }
+
+  // Forwarding functions: just delegate to a real AA implementation, counting
+  // the number of responses...
+  AliasResult alias(const MemoryLocation &LocA,
+                    const MemoryLocation &LocB) override;
+
+  ModRefInfo getModRefInfo(ImmutableCallSite CS,
+                           const MemoryLocation &Loc) override;
+  ModRefInfo getModRefInfo(ImmutableCallSite CS1,
+                           ImmutableCallSite CS2) override {
+    return AliasAnalysis::getModRefInfo(CS1, CS2);
+  }
+};
+
+//===--------------------------------------------------------------------===//
+//
+// createAliasAnalysisCounterPass - This pass counts alias queries and how the
+// alias analysis implementation responds.
+//
+ModulePass *createAliasAnalysisCounterPass();
 
 }
 

Modified: llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp?rev=245005&r1=245004&r2=245005&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp Thu Aug 13 21:07:05 2015
@@ -22,10 +22,10 @@
 #include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
-static cl::opt<bool>
-PrintAll("count-aa-print-all-queries", cl::ReallyHidden, cl::init(true));
-static cl::opt<bool>
-PrintAllFailures("count-aa-print-all-failed-queries", cl::ReallyHidden);
+static cl::opt<bool> PrintAll("count-aa-print-all-queries", cl::ReallyHidden,
+                              cl::init(true));
+static cl::opt<bool> PrintAllFailures("count-aa-print-all-failed-queries",
+                                      cl::ReallyHidden);
 
 char AliasAnalysisCounter::ID = 0;
 INITIALIZE_AG_PASS(AliasAnalysisCounter, AliasAnalysis, "count-aa",
@@ -41,10 +41,22 @@ AliasResult AliasAnalysisCounter::alias(
 
   const char *AliasString = nullptr;
   switch (R) {
-  case NoAlias:   No++;   AliasString = "No alias"; break;
-  case MayAlias:  May++;  AliasString = "May alias"; break;
-  case PartialAlias: Partial++; AliasString = "Partial alias"; break;
-  case MustAlias: Must++; AliasString = "Must alias"; break;
+  case NoAlias:
+    No++;
+    AliasString = "No alias";
+    break;
+  case MayAlias:
+    May++;
+    AliasString = "May alias";
+    break;
+  case PartialAlias:
+    Partial++;
+    AliasString = "Partial alias";
+    break;
+  case MustAlias:
+    Must++;
+    AliasString = "Must alias";
+    break;
   }
 
   if (PrintAll || (PrintAllFailures && R == MayAlias)) {




More information about the llvm-commits mailing list