aboutsummaryrefslogtreecommitdiffstats
path: root/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
commit916c954bf20f48c3269542fc919ccb92a99496ee (patch)
tree996cda99e1e4e03c375d527f6b63c885f4e3864f /lib/Transforms
parentab5d56c6b974b5bcfa0b63e7ae024a53f0edd771 (diff)
downloadexternal_llvm-916c954bf20f48c3269542fc919ccb92a99496ee.tar.gz
external_llvm-916c954bf20f48c3269542fc919ccb92a99496ee.tar.bz2
external_llvm-916c954bf20f48c3269542fc919ccb92a99496ee.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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46932 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index c80f050730..3929d0c919 100644
--- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/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);