CodeGen: Copy-ctorm must obey the destination's alignment requirement
We would synthesize memcpy intrinsics when emitting calls to trivial C++ constructors but we wouldn't take into account the alignment of the destination. llvm-svn: 228061
This commit is contained in:
@@ -1559,6 +1559,15 @@ public:
|
||||
true);
|
||||
}
|
||||
|
||||
void EmitAggregateCopyCtor(llvm::Value *DestPtr, llvm::Value *SrcPtr,
|
||||
QualType DestTy, QualType SrcTy) {
|
||||
CharUnits DestTypeAlign = getContext().getTypeAlignInChars(DestTy);
|
||||
CharUnits SrcTypeAlign = getContext().getTypeAlignInChars(SrcTy);
|
||||
EmitAggregateCopy(DestPtr, SrcPtr, SrcTy, /*IsVolatile=*/false,
|
||||
std::min(DestTypeAlign, SrcTypeAlign),
|
||||
/*IsAssignment=*/false);
|
||||
}
|
||||
|
||||
/// EmitAggregateCopy - Emit an aggregate copy.
|
||||
///
|
||||
/// \param isVolatile - True iff either the source or the destination is
|
||||
|
||||
Reference in New Issue
Block a user