Implement handling of constantexprs for disambiguation. This implements

BasicAA/featuretest.ll:constexpr_test

llvm-svn: 6740
This commit is contained in:
Chris Lattner 2003-06-17 15:25:37 +00:00
parent b9119b3ed4
commit 1bec75e730
1 changed files with 6 additions and 0 deletions

View File

@ -69,6 +69,12 @@ static const Value *getUnderlyingObject(const Value *V) {
if (const Instruction *I = dyn_cast<Instruction>(V)) {
if (isa<CastInst>(I) || isa<GetElementPtrInst>(I))
return getUnderlyingObject(I->getOperand(0));
} else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) {
if (CE->getOpcode() == Instruction::Cast ||
CE->getOpcode() == Instruction::GetElementPtr)
return getUnderlyingObject(CE->getOperand(0));
} else if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(V)) {
return CPR->getValue();
}
return 0;
}