rust/tests
Patrick Walton 0becc89d4a rustc_target: Add alignment to indirectly-passed by-value types, correcting the
alignment of `byval` on x86 in the process.

Commit 88e4d2c291 from five years ago removed
support for alignment on indirectly-passed arguments because of problems with
the `i686-pc-windows-msvc` target. Unfortunately, the `memcpy` optimizations I
recently added to LLVM 16 depend on this to forward `memcpy`s. This commit
attempts to fix the problems with `byval` parameters on that target and now
correctly adds the `align` attribute.

The problem is summarized in [this comment] by @eddyb. Briefly, 32-bit x86 has
special alignment rules for `byval` parameters: for the most part, their
alignment is forced to 4. This is not well-documented anywhere but in the Clang
source. I looked at the logic in Clang `TargetInfo.cpp` and tried to replicate
it here. The relevant methods in that file are
`X86_32ABIInfo::getIndirectResult()` and
`X86_32ABIInfo::getTypeStackAlignInBytes()`. The `align` parameter attribute
for `byval` parameters in LLVM must match the platform ABI, or miscompilations
will occur. Note that this doesn't use the approach suggested by eddyb, because
I felt it was overkill to store the alignment in `on_stack` when special
handling is really only needed for 32-bit x86.

As a side effect, this should fix , because it will make the `align`
parameter attribute for `byval` parameters match the platform ABI on LLVM
x86-64.

[this comment]: https://github.com/rust-lang/rust/pull/80822#issuecomment-829985417
2023-07-10 19:19:30 -04:00
..
assembly test-various: run codegen and assembly tests 2023-07-02 02:22:22 +02:00
auxiliary
codegen rustc_target: Add alignment to indirectly-passed by-value types, correcting the 2023-07-10 19:19:30 -04:00
codegen-units
debuginfo
incremental
mir-opt Rollup merge of - ericmarkmartin:lower-type-relative-ctor-to-adt, r=cjgillot 2023-07-08 20:53:29 +02:00
pretty
run-coverage Re-enable some coverage tests on Linux 2023-07-06 10:19:31 +10:00
run-coverage-rustdoc Re-bless the newly-migrated tests 2023-06-28 11:09:19 +10:00
run-make rustc_target: Add alignment to indirectly-passed by-value types, correcting the 2023-07-10 19:19:30 -04:00
run-make-fulldeps Provide more context for rustc +nightly -Zunstable-options on stable 2023-06-27 23:23:33 +08:00
run-pass-valgrind
rustdoc Rollup merge of - GuillaumeGomez:improve-code-comments, r=notriddle 2023-06-27 07:01:32 +02:00
rustdoc-gui Migrate GUI colors test to original CSS color format 2023-07-08 14:56:15 +02:00
rustdoc-js Auto merge of - notriddle:notriddle/search-unify, r=GuillaumeGomez 2023-06-15 03:04:46 +00:00
rustdoc-js-std Auto merge of - GuillaumeGomez:rustdoc-search-whitespace-as-separator, r=notriddle 2023-07-02 18:49:29 +00:00
rustdoc-json
rustdoc-ui
ui Auto merge of - spastorino:new-rpitit-24, r=compiler-errors 2023-07-10 19:01:30 +00:00
ui-fulldeps Rollup merge of - spastorino:smir-types-1, r=oli-obk 2023-07-08 15:49:47 +02:00
COMPILER_TESTS.md