aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/Steensgaard.cpp
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2002-12-12 05:34:10 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2002-12-12 05:34:10 +0000
commitf4445dfcb76d1bf3cea287291c0c5f2bf3436e69 (patch)
treed483449d34efb66e08f6005864b0903cf6bef668 /lib/Analysis/DataStructure/Steensgaard.cpp
parentc2799163e2d8bb6a1d2c93ab4f0911da75b87ad4 (diff)
'graph' is spelled without a 'c'.
Also added Statistic counters for NoAlias and MayAlias. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4972 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/Steensgaard.cpp')
-rw-r--r--lib/Analysis/DataStructure/Steensgaard.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Analysis/DataStructure/Steensgaard.cpp b/lib/Analysis/DataStructure/Steensgaard.cpp
index e42ef23176..0994a22426 100644
--- a/lib/Analysis/DataStructure/Steensgaard.cpp
+++ b/lib/Analysis/DataStructure/Steensgaard.cpp
@@ -14,6 +14,11 @@
#include "Support/Statistic.h"
namespace {
+ Statistic<> NumNoAlias ("steens", "Number of 'no alias' replies");
+ Statistic<> NumMayAlias ("steens", "Number of 'may alias' replies");
+};
+
+namespace {
class Steens : public Pass, public AliasAnalysis {
DSGraph *ResultGraph;
public:
@@ -202,7 +207,7 @@ bool Steens::run(Module &M) {
// alias - This is the only method here that does anything interesting...
AliasAnalysis::Result Steens::alias(const Value *V1, const Value *V2) {
- assert(ResultGraph && "Result grcaph has not yet been computed!");
+ assert(ResultGraph && "Result graph has not been computed yet!");
std::map<Value*, DSNodeHandle> &GVM = ResultGraph->getScalarMap();
@@ -214,9 +219,10 @@ AliasAnalysis::Result Steens::alias(const Value *V1, const Value *V2) {
DSNodeHandle &V2H = J->second;
// If the two pointers point to different data structure graph nodes, they
// cannot alias!
- if (V1H.getNode() != V2H.getNode())
+ if (V1H.getNode() != V2H.getNode()) {
+ ++NumNoAlias;
return NoAlias;
-
+ }
// FIXME: If the two pointers point to the same node, and the offsets are
// different, and the LinkIndex vector doesn't alias the section, then the
// two pointers do not alias. We need access size information for the two
@@ -225,6 +231,9 @@ AliasAnalysis::Result Steens::alias(const Value *V1, const Value *V2) {
}
}
+ // Since Steensgaard cannot do any better, count it as a 'may alias'
+ ++NumMayAlias;
+
// If we cannot determine alias properties based on our graph, fall back on
// some other AA implementation.
//