[llvm-commits] [llvm] r80267 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
Dan Gohman
gohman at apple.com
Thu Aug 27 11:02:03 PDT 2009
Author: djg
Date: Thu Aug 27 13:02:03 2009
New Revision: 80267
URL: http://llvm.org/viewvc/llvm-project?rev=80267&view=rev
Log:
Use stripPointerCasts instead of doing the same manually.
Modified:
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=80267&r1=80266&r2=80267&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Thu Aug 27 13:02:03 2009
@@ -308,13 +308,9 @@
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 @@
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();
More information about the llvm-commits
mailing list