diff options
author | Chris Lattner <sabre@nondot.org> | 2011-05-22 23:21:23 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-05-22 23:21:23 +0000 |
commit | 44c2b90556c2636afe8b62a2db7c714a32b8689b (patch) | |
tree | 8842b47b0055b88b5d97a8998fa29351645c492b /clang/lib/CodeGen | |
parent | f3ef3d2af95e8cd20bb9bd9aeceb24b4bf8107ca (diff) | |
download | bcm5719-llvm-44c2b90556c2636afe8b62a2db7c714a32b8689b.tar.gz bcm5719-llvm-44c2b90556c2636afe8b62a2db7c714a32b8689b.zip |
Fix x86-64 byval passing to specify the alignment even when the code
generator will give it something sufficient. This is important because
the mid-level optimizer doesn't know what alignment is required otherwise.
llvm-svn: 131879
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 73526fbfdd0..5ac5ea4ac40 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -1315,13 +1315,10 @@ ABIArgInfo X86_64ABIInfo::getIndirectResult(QualType Ty) const { if (isRecordWithNonTrivialDestructorOrCopyConstructor(Ty)) return ABIArgInfo::getIndirect(0, /*ByVal=*/false); - // Compute the byval alignment. We trust the back-end to honor the - // minimum ABI alignment for byval, to make cleaner IR. - const unsigned MinABIAlign = 8; - unsigned Align = getContext().getTypeAlign(Ty) / 8; - if (Align > MinABIAlign) - return ABIArgInfo::getIndirect(Align); - return ABIArgInfo::getIndirect(0); + // Compute the byval alignment. We specify the alignment of the byval in all + // cases so that the mid-level optimizer knows the alignment of the byval. + unsigned Align = std::max(getContext().getTypeAlign(Ty) / 8, 8U); + return ABIArgInfo::getIndirect(Align); } /// Get16ByteVectorType - The ABI specifies that a value should be passed in an |