summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2016-02-11 21:10:40 +0000
committerPete Cooper <peter_cooper@apple.com>2016-02-11 21:10:40 +0000
commit5562c333b8b792e9251b079b74d0b57b9d787b18 (patch)
tree0bc34e72e0931dbec37a4a79d60edbd61c137cd2 /llvm/lib/Transforms
parentc67f5a6ab1a3b2ea5b9c7c5dc586998fedfd1ace (diff)
downloadbcm5719-llvm-5562c333b8b792e9251b079b74d0b57b9d787b18.tar.gz
bcm5719-llvm-5562c333b8b792e9251b079b74d0b57b9d787b18.zip
Set load alignment on aggregate loads.
When optimizing a extractvalue(load), we generate a load from the aggregate type. This load didn't have alignment set and so would get the alignment of the type. This breaks when the type is packed and so the alignment should be lower. For example, loading { int, int } would give us alignment of 4, but the original load from this type may have an alignment of 1 if packed. Reviewed by David Majnemer Differential revision: http://reviews.llvm.org/D17158 llvm-svn: 260587
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
index 9573aab6dcb..da7d5fb33d3 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -552,7 +552,8 @@ static Instruction *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) {
ConstantInt::get(IdxType, i),
};
auto *Ptr = IC.Builder->CreateInBoundsGEP(ST, Addr, makeArrayRef(Indices), EltName);
- auto *L = IC.Builder->CreateLoad(ST->getTypeAtIndex(i), Ptr, LoadName);
+ auto *L = IC.Builder->CreateAlignedLoad(Ptr, LI.getAlignment(),
+ LoadName);
V = IC.Builder->CreateInsertValue(V, L, i);
}
OpenPOWER on IntegriCloud