diff options
author | Chris Lattner <sabre@nondot.org> | 2004-07-21 03:56:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-07-21 03:56:54 +0000 |
commit | fdcf624939f989c20cc3ce3bf2d2f0d0f8c3cabd (patch) | |
tree | 15a4865557c7f9105e86fa9437ef8df1e148cec2 /llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
parent | cd4ae3a3fd509ec6a36195bec0dd917635fd6775 (diff) | |
download | bcm5719-llvm-fdcf624939f989c20cc3ce3bf2d2f0d0f8c3cabd.tar.gz bcm5719-llvm-fdcf624939f989c20cc3ce3bf2d2f0d0f8c3cabd.zip |
Do not ignore casts unless they are pointer-pointer casts. This caused us
to miscompile the SingleSource/Regression/C++/pointer_member.cpp program.
llvm-svn: 15062
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index f95adb32929..c0949079cc1 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -240,10 +240,12 @@ 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->getOpcode() == Instruction::Cast) + if (CE->getOpcode() == Instruction::Cast && + isa<PointerType>(CE->getOperand(0)->getType())) V1 = CE->getOperand(0); if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(V2)) - if (CE->getOpcode() == Instruction::Cast) + if (CE->getOpcode() == Instruction::Cast && + isa<PointerType>(CE->getOperand(0)->getType())) V2 = CE->getOperand(0); // Are we checking for alias of the same value? @@ -255,9 +257,11 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size, // Strip off cast instructions... if (const Instruction *I = dyn_cast<CastInst>(V1)) - return alias(I->getOperand(0), V1Size, V2, V2Size); + if (isa<PointerType>(I->getOperand(0)->getType())) + return alias(I->getOperand(0), V1Size, V2, V2Size); if (const Instruction *I = dyn_cast<CastInst>(V2)) - return alias(V1, V1Size, I->getOperand(0), V2Size); + if (isa<PointerType>(I->getOperand(0)->getType())) + return alias(V1, V1Size, I->getOperand(0), V2Size); // Figure out what objects these things are pointing to if we can... const Value *O1 = getUnderlyingObject(V1); |