summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-03-23 01:48:09 +0000
committerChris Lattner <sabre@nondot.org>2005-03-23 01:48:09 +0000
commite36d77b7264ad838a619cc86fbf4c9b8cb42abed (patch)
treeda9878e85ee63df37775b00c9a41712da43d2d84 /llvm/lib/Analysis
parent13417b5be36e81015a7a8cb3bb6d204200600f7e (diff)
downloadbcm5719-llvm-e36d77b7264ad838a619cc86fbf4c9b8cb42abed.tar.gz
bcm5719-llvm-e36d77b7264ad838a619cc86fbf4c9b8cb42abed.zip
Make -steens-aa more conservative (aka correct) by making sure to obey
incompleteness flags. Make it more aggressive by taking field sensitive information into account. llvm-svn: 20781
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/DataStructure/Steensgaard.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Steensgaard.cpp b/llvm/lib/Analysis/DataStructure/Steensgaard.cpp
index 17863d1ce0b..a80a3e66764 100644
--- a/llvm/lib/Analysis/DataStructure/Steensgaard.cpp
+++ b/llvm/lib/Analysis/DataStructure/Steensgaard.cpp
@@ -192,21 +192,31 @@ AliasAnalysis::AliasResult Steens::alias(const Value *V1, unsigned V1Size,
DSGraph::ScalarMapTy &GSM = ResultGraph->getScalarMap();
DSGraph::ScalarMapTy::iterator I = GSM.find(const_cast<Value*>(V1));
- if (I != GSM.end() && I->second.getNode()) {
+ if (I != GSM.end() && !I->second.isNull() &&
+ I->second.getNode()->isComplete()) {
DSNodeHandle &V1H = I->second;
DSGraph::ScalarMapTy::iterator J=GSM.find(const_cast<Value*>(V2));
- if (J != GSM.end() && J->second.getNode()) {
+ if (J != GSM.end() && !J->second.isNull() &&
+ J->second.getNode()->isComplete()) {
DSNodeHandle &V2H = J->second;
// If the two pointers point to different data structure graph nodes, they
// cannot alias!
- if (V1H.getNode() != V2H.getNode()) // FIXME: Handle incompleteness!
+ if (V1H.getNode() != V2H.getNode())
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
- // accesses though!
- //
+ // See if they point to different offsets... if so, we may be able to
+ // determine that they do not alias...
+ unsigned O1 = I->second.getOffset(), O2 = J->second.getOffset();
+ if (O1 != O2) {
+ if (O2 < O1) { // Ensure that O1 <= O2
+ std::swap(V1, V2);
+ std::swap(O1, O2);
+ std::swap(V1Size, V2Size);
+ }
+
+ if (O1+V1Size <= O2)
+ return NoAlias;
+ }
}
}
OpenPOWER on IntegriCloud