mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
Do not ignore casts unless they are pointer-pointer casts. This caused us
to miscompile the SingleSource/Regression/C++/pointer_member.cpp program. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15062 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
adfe28d136
commit
bb8f43c8fc
@ -240,10 +240,12 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size,
|
|||||||
const Value *V2, unsigned V2Size) {
|
const Value *V2, unsigned V2Size) {
|
||||||
// Strip off any constant expression casts if they exist
|
// Strip off any constant expression casts if they exist
|
||||||
if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(V1))
|
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);
|
V1 = CE->getOperand(0);
|
||||||
if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(V2))
|
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);
|
V2 = CE->getOperand(0);
|
||||||
|
|
||||||
// Are we checking for alias of the same value?
|
// Are we checking for alias of the same value?
|
||||||
@ -255,9 +257,11 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size,
|
|||||||
|
|
||||||
// Strip off cast instructions...
|
// Strip off cast instructions...
|
||||||
if (const Instruction *I = dyn_cast<CastInst>(V1))
|
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))
|
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...
|
// Figure out what objects these things are pointing to if we can...
|
||||||
const Value *O1 = getUnderlyingObject(V1);
|
const Value *O1 = getUnderlyingObject(V1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user