From bc1d841a63871abb6ad599b0d4ffb31f51ff081c Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 27 Aug 2009 18:02:03 +0000 Subject: Use stripPointerCasts instead of doing the same manually. llvm-svn: 80267 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp') diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 286f12a1ba1..9e9d0f10d09 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/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(V1)) - if (CE->isCast() && isa(CE->getOperand(0)->getType())) - V1 = CE->getOperand(0); - if (const ConstantExpr *CE = dyn_cast(V2)) - if (CE->isCast() && isa(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(V1->getType()) || !isa(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(V1)) - return alias(I->getOperand(0), V1Size, V2, V2Size); - if (const BitCastInst *I = dyn_cast(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(); -- cgit v1.2.3