summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-02-10 19:05:37 +0000
committerChris Lattner <sabre@nondot.org>2008-02-10 19:05:37 +0000
commitdcddd644248e74712dae073ba540779cae637d35 (patch)
tree72697bf75bf980dcabdae3b4cce6931d301d6164 /llvm/lib/Transforms
parent3050f74a1d490f2beebe62e4777b6149aef46786 (diff)
downloadbcm5719-llvm-dcddd644248e74712dae073ba540779cae637d35.tar.gz
bcm5719-llvm-dcddd644248e74712dae073ba540779cae637d35.zip
Fix scalarrepl to not 'miscompile' undefined code, part #2.
This fixes the store case, my previous patch just fixed the load case. rdar://5707076. llvm-svn: 46932
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index c80f050730a..3929d0c9192 100644
--- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -1150,7 +1150,7 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) {
// then 'or' into place.
Value *SV = SI->getOperand(0);
const Type *AllocaType = NewAI->getType()->getElementType();
- if (SV->getType() == AllocaType) {
+ if (SV->getType() == AllocaType && Offset == 0) {
// All is well.
} else if (const VectorType *PTy = dyn_cast<VectorType>(AllocaType)) {
Value *Old = new LoadInst(NewAI, NewAI->getName()+".in", SI);
OpenPOWER on IntegriCloud