aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-08-27 18:02:03 +0000
committerDan Gohman <gohman@apple.com>2009-08-27 18:02:03 +0000
commitf8b840f45084d2486be3fd074807d9a37564a33d (patch)
tree275404f2fd06f4088c0e15588f5a4caf16b5a474 /lib/Analysis
parenta578538e9fde98cb05ce9740d7c63aafbd1c69f4 (diff)
downloadexternal_llvm-f8b840f45084d2486be3fd074807d9a37564a33d.zip
external_llvm-f8b840f45084d2486be3fd074807d9a37564a33d.tar.gz
external_llvm-f8b840f45084d2486be3fd074807d9a37564a33d.tar.bz2
Use stripPointerCasts instead of doing the same manually.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80267 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/BasicAliasAnalysis.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index 286f12a..9e9d0f1 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -308,13 +308,9 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS1, CallSite CS2) {
AliasAnalysis::AliasResult
BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size,
const Value *V2, unsigned V2Size) {
- // Strip off any constant expression casts if they exist
- if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(V1))
- if (CE->isCast() && isa<PointerType>(CE->getOperand(0)->getType()))
- V1 = CE->getOperand(0);
- if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(V2))
- if (CE->isCast() && isa<PointerType>(CE->getOperand(0)->getType()))
- V2 = CE->getOperand(0);
+ // Strip off any casts if they exist.
+ V1 = V1->stripPointerCasts();
+ V2 = V2->stripPointerCasts();
// Are we checking for alias of the same value?
if (V1 == V2) return MustAlias;
@@ -322,13 +318,6 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size,
if (!isa<PointerType>(V1->getType()) || !isa<PointerType>(V2->getType()))
return NoAlias; // Scalars cannot alias each other
- // Strip off cast instructions. Since V1 and V2 are pointers, they must be
- // pointer<->pointer bitcasts.
- if (const BitCastInst *I = dyn_cast<BitCastInst>(V1))
- return alias(I->getOperand(0), V1Size, V2, V2Size);
- if (const BitCastInst *I = dyn_cast<BitCastInst>(V2))
- return alias(V1, V1Size, I->getOperand(0), V2Size);
-
// Figure out what objects these things are pointing to if we can.
const Value *O1 = V1->getUnderlyingObject();
const Value *O2 = V2->getUnderlyingObject();