aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-10 18:19:22 +0000
committerChris Lattner <sabre@nondot.org>2010-04-10 18:19:22 +0000
commita2fb234b04eb632fb23aff72e56fd3962aa56e65 (patch)
tree966f4cc5ab155f4d9385b8befbdb5c59f3883465 /lib/Transforms
parentf7240de877e790d9e377c1fe49b6d7a14c1a9674 (diff)
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
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index b01220e375..f5f9e5d9bc 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/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;