summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-04-17 01:14:29 +0000
committerChad Rosier <mcrosier@apple.com>2012-04-17 01:14:29 +0000
commit1e303eefaf0d2829228e03026637453e272c9950 (patch)
tree4a590414a9cb22f80ea94939e5a61f37a417daa6 /clang/lib/CodeGen
parentbe4ef0818da8e0a45380d008faae0b595b346879 (diff)
downloadbcm5719-llvm-1e303eefaf0d2829228e03026637453e272c9950.tar.gz
bcm5719-llvm-1e303eefaf0d2829228e03026637453e272c9950.zip
Fix case where the alignment is overaligned, per Eli's suggestion.
rdar://11220251 llvm-svn: 154893
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGExprAgg.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index d345154f013..7b0e0f5157c 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -238,7 +238,10 @@ void AggExprEmitter::EmitMoveFromReturnSlot(const Expr *E, RValue Src) {
// Otherwise, do a final copy,
assert(Dest.getAddr() != Src.getAggregateAddr());
- EmitFinalDestCopy(E, Src, /*Ignore*/ true, Dest.getAlignment().getQuantity());
+ std::pair<CharUnits, CharUnits> TypeInfo =
+ CGF.getContext().getTypeInfoInChars(E->getType());
+ CharUnits Alignment = std::min(TypeInfo.second, Dest.getAlignment());
+ EmitFinalDestCopy(E, Src, /*Ignore*/ true, Alignment.getQuantity());
}
/// EmitFinalDestCopy - Perform the final copy to DestPtr, if desired.
OpenPOWER on IntegriCloud