aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/BasicAliasAnalysis.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2011-06-04 00:46:31 +0000
committerDan Gohman <gohman@apple.com>2011-06-04 00:46:31 +0000
commit27b82f2f91c47ba26189c69337469c43ebb071eb (patch)
tree41d02ab8302d1dd3babd68f5bf25b4629cbbef13 /llvm/lib/Analysis/BasicAliasAnalysis.cpp
parent1b291b22d0f41dbe5771b9f75cab322fc3e87529 (diff)
downloadllvm-27b82f2f91c47ba26189c69337469c43ebb071eb.zip
llvm-27b82f2f91c47ba26189c69337469c43ebb071eb.tar.gz
llvm-27b82f2f91c47ba26189c69337469c43ebb071eb.tar.bz2
Reapply r131781 (revert r131809), now that some BasicAA shortcomings
it exposed are fixed. llvm-svn: 132611
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/BasicAliasAnalysis.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 24297d4..3d10a5f 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -944,7 +944,17 @@ BasicAliasAnalysis::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
return NoAlias;
}
- return MayAlias;
+ // Statically, we can see that the base objects are the same, but the
+ // pointers have dynamic offsets which we can't resolve. And none of our
+ // little tricks above worked.
+ //
+ // TODO: Returning PartialAlias instead of MayAlias is a mild hack; the
+ // practical effect of this is protecting TBAA in the case of dynamic
+ // indices into arrays of unions. An alternative way to solve this would
+ // be to have clang emit extra metadata for unions and/or union accesses.
+ // A union-specific solution wouldn't handle the problem for malloc'd
+ // memory however.
+ return PartialAlias;
}
static AliasAnalysis::AliasResult