fix PR6760, a missing check in heap SRoA.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100936 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-04-10 18:19:22 +00:00
parent f7240de877
commit a2fb234b04
2 changed files with 29 additions and 2 deletions

View File

@ -966,7 +966,8 @@ static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(const Instruction *V,
continue; // Otherwise, storing through it, or storing into GV... fine.
}
if (isa<GetElementPtrInst>(Inst)) {
// Must index into the array and into the struct.
if (isa<GetElementPtrInst>(Inst) && Inst->getNumOperands() >= 3) {
if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Inst, GV, PHIs))
return false;
continue;