diff options
| author | bors <bors@rust-lang.org> | 2024-03-11 04:45:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-03-11 04:45:27 +0000 |
| commit | a6d93acf5fdeb020ab86cc0d30d5672c23a7dba6 (patch) | |
| tree | aa2473461cfbc2f595aed3c609d895c4add75624 /tests/codegen/align-byval-vector.rs | |
| parent | c69fda7dc664e62f8920a02a4e55d6207b212c24 (diff) | |
| parent | f18c2f83e99ace7b9ad94a8204ff5fd68807ef34 (diff) | |
| download | rust-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/align-byval-vector.rs')
| -rw-r--r-- | tests/codegen/align-byval-vector.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/codegen/align-byval-vector.rs b/tests/codegen/align-byval-vector.rs index 6596792ec88..02b7d6b0c5e 100644 --- a/tests/codegen/align-byval-vector.rs +++ b/tests/codegen/align-byval-vector.rs @@ -37,12 +37,12 @@ pub struct DoubleFoo { } extern "C" { - // x86-linux: declare void @f({{.*}}byval(%Foo) align 4{{.*}}) - // x86-darwin: declare void @f({{.*}}byval(%Foo) align 16{{.*}}) + // x86-linux: declare void @f({{.*}}byval([32 x i8]) align 4{{.*}}) + // x86-darwin: declare void @f({{.*}}byval([32 x i8]) align 16{{.*}}) fn f(foo: Foo); - // x86-linux: declare void @g({{.*}}byval(%DoubleFoo) align 4{{.*}}) - // x86-darwin: declare void @g({{.*}}byval(%DoubleFoo) align 16{{.*}}) + // x86-linux: declare void @g({{.*}}byval([64 x i8]) align 4{{.*}}) + // x86-darwin: declare void @g({{.*}}byval([64 x i8]) align 16{{.*}}) fn g(foo: DoubleFoo); } |
