Skip to content

Commit df01040

Browse files
authored
Rollup merge of #134396 - mustartt:byval-pointer-natural-alignment, r=wesleywiser
AIX: use align 8 for byval parameter On AIX, byval pointer arguments are aligned to 8 bytes based on the 64bit register size. For example, the C callee https://godbolt.org/z/5f4vnG6bh will expect the following argument. ``` ptr nocapture noundef readonly byval(%struct.TwoU64s) align 8 %0 ``` This case is captured by `run-make/extern-fn-explicit-align`
2 parents cd1f36b + 7bfcddf commit df01040

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/rustc_target/src/callconv/powerpc64.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ where
5858

5959
// The AIX ABI expect byval for aggregates
6060
// See https://github.com./llvm/llvm-project/blob/main/clang/lib/CodeGen/Targets/PPC.cpp.
61+
// The incoming parameter is represented as a pointer in the IR,
62+
// the alignment is associated with the size of the register. (align 8 for 64bit)
6163
if !is_ret && abi == AIX {
62-
arg.pass_by_stack_offset(None);
64+
arg.pass_by_stack_offset(Some(Align::from_bytes(8).unwrap()));
6365
return;
6466
}
6567

0 commit comments

Comments
 (0)