diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-10 18:19:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-10 18:19:22 +0000 |
commit | b9801ffcb530dc89c90e146a6c2aae4387e5e852 (patch) | |
tree | 87b4a2771b050247462005bc138bd1f44e727433 /llvm/lib/Transforms | |
parent | 06ef31c8b1e3adaad58550a03862d74e86b08b7e (diff) | |
download | bcm5719-llvm-b9801ffcb530dc89c90e146a6c2aae4387e5e852.tar.gz bcm5719-llvm-b9801ffcb530dc89c90e146a6c2aae4387e5e852.zip |
fix PR6760, a missing check in heap SRoA.
llvm-svn: 100936
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index b01220e3756..f5f9e5d9bc1 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -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; |