about summary refs log tree commit diff
path: root/tests/codegen/function-arguments.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-11 04:45:27 +0000
committerbors <bors@rust-lang.org>2024-03-11 04:45:27 +0000
commita6d93acf5fdeb020ab86cc0d30d5672c23a7dba6 (patch)
treeaa2473461cfbc2f595aed3c609d895c4add75624 /tests/codegen/function-arguments.rs
parentc69fda7dc664e62f8920a02a4e55d6207b212c24 (diff)
parentf18c2f83e99ace7b9ad94a8204ff5fd68807ef34 (diff)
downloadrust-a6d93acf5fdeb020ab86cc0d30d5672c23a7dba6.tar.gz
rust-a6d93acf5fdeb020ab86cc0d30d5672c23a7dba6.zip
Auto merge of #122050 - erikdesjardins:sret, r=nikic
Stop using LLVM struct types for byval/sret

For `byval` and `sret`, the type has no semantic meaning, only the size matters\*†. Using `[N x i8]` is a more direct way to specify that we want `N` bytes, and avoids relying on LLVM's struct layout.

\*: The alignment would matter, if we didn't explicitly specify it. From what I can tell, we always specified the alignment for `sret`; for `byval`, we didn't until #112157.

†: For `byval`, the hidden copy may be impacted by padding in the LLVM struct type, i.e. padding bytes may not be copied. (I'm not sure if this is done today, but I think it would be legal.) But we manually pad our LLVM struct types specifically to avoid there ever being LLVM-visible padding, so that shouldn't be an issue.

Split out from #121577.

r? `@nikic`
Diffstat (limited to 'tests/codegen/function-arguments.rs')
-rw-r--r--tests/codegen/function-arguments.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/codegen/function-arguments.rs b/tests/codegen/function-arguments.rs
index e6e2f645714..468ec0a7753 100644
--- a/tests/codegen/function-arguments.rs
+++ b/tests/codegen/function-arguments.rs
@@ -198,7 +198,7 @@ pub fn notunpin_box(x: Box<NotUnpin>) -> Box<NotUnpin> {
   x
 }
 
-// CHECK: @struct_return(ptr noalias nocapture noundef sret(%S) align 4 dereferenceable(32){{( %_0)?}})
+// CHECK: @struct_return(ptr noalias nocapture noundef sret([32 x i8]) align 4 dereferenceable(32){{( %_0)?}})
 #[no_mangle]
 pub fn struct_return() -> S {
   S {