Fix a couple of minor problems. Because PHI nodes can use themselves, this

could cause infinite loops.  Also, getUnderlyingObject can return null

llvm-svn: 12351
This commit is contained in:
Chris Lattner 2004-03-12 23:12:55 +00:00
parent 13875932b2
commit f9e69b4553
1 changed files with 1 additions and 4 deletions

View File

@ -159,9 +159,6 @@ static bool AddressMightEscape(const Value *V) {
return true;
if (AddressMightEscape(I)) return true;
break;
case Instruction::PHI:
if (AddressMightEscape(I)) return true;
break;
default:
return true;
}
@ -178,7 +175,7 @@ AliasAnalysis::ModRefResult
BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
if (!isa<Constant>(P) && !isa<GlobalValue>(P))
if (const AllocationInst *AI =
dyn_cast<AllocationInst>(getUnderlyingObject(P))) {
dyn_cast_or_null<AllocationInst>(getUnderlyingObject(P))) {
// Okay, the pointer is to a stack allocated object. If we can prove that
// the pointer never "escapes", then we know the call cannot clobber it,
// because it simply can't get its address.