Skip to content

Commit a6d93ac

Browse files
committed
Auto merge of rust-lang#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 rust-lang#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 rust-lang#121577. r? `@nikic`
2 parents c69fda7 + f18c2f8 commit a6d93ac

17 files changed

+329
-132
lines changed

compiler/rustc_codegen_llvm/src/abi.rs

+16-4
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,10 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
424424
PassMode::Indirect { attrs, meta_attrs: _, on_stack } => {
425425
assert!(!on_stack);
426426
let i = apply(attrs);
427-
let sret = llvm::CreateStructRetAttr(cx.llcx, self.ret.layout.llvm_type(cx));
427+
let sret = llvm::CreateStructRetAttr(
428+
cx.llcx,
429+
cx.type_array(cx.type_i8(), self.ret.layout.size.bytes()),
430+
);
428431
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Argument(i), &[sret]);
429432
}
430433
PassMode::Cast { cast, pad_i32: _ } => {
@@ -437,7 +440,10 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
437440
PassMode::Ignore => {}
438441
PassMode::Indirect { attrs, meta_attrs: None, on_stack: true } => {
439442
let i = apply(attrs);
440-
let byval = llvm::CreateByValAttr(cx.llcx, arg.layout.llvm_type(cx));
443+
let byval = llvm::CreateByValAttr(
444+
cx.llcx,
445+
cx.type_array(cx.type_i8(), arg.layout.size.bytes()),
446+
);
441447
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Argument(i), &[byval]);
442448
}
443449
PassMode::Direct(attrs)
@@ -486,7 +492,10 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
486492
PassMode::Indirect { attrs, meta_attrs: _, on_stack } => {
487493
assert!(!on_stack);
488494
let i = apply(bx.cx, attrs);
489-
let sret = llvm::CreateStructRetAttr(bx.cx.llcx, self.ret.layout.llvm_type(bx));
495+
let sret = llvm::CreateStructRetAttr(
496+
bx.cx.llcx,
497+
bx.cx.type_array(bx.cx.type_i8(), self.ret.layout.size.bytes()),
498+
);
490499
attributes::apply_to_callsite(callsite, llvm::AttributePlace::Argument(i), &[sret]);
491500
}
492501
PassMode::Cast { cast, pad_i32: _ } => {
@@ -513,7 +522,10 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
513522
PassMode::Ignore => {}
514523
PassMode::Indirect { attrs, meta_attrs: None, on_stack: true } => {
515524
let i = apply(bx.cx, attrs);
516-
let byval = llvm::CreateByValAttr(bx.cx.llcx, arg.layout.llvm_type(bx));
525+
let byval = llvm::CreateByValAttr(
526+
bx.cx.llcx,
527+
bx.cx.type_array(bx.cx.type_i8(), arg.layout.size.bytes()),
528+
);
517529
attributes::apply_to_callsite(
518530
callsite,
519531
llvm::AttributePlace::Argument(i),

compiler/rustc_target/src/abi/call/mod.rs

+33-4
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,24 @@ pub enum PassMode {
4646
///
4747
/// The argument has a layout abi of `ScalarPair`.
4848
Pair(ArgAttributes, ArgAttributes),
49-
/// Pass the argument after casting it. See the `CastTarget` docs for details. The bool
50-
/// indicates if a `Reg::i32()` dummy argument is emitted before the real argument.
49+
/// Pass the argument after casting it. See the `CastTarget` docs for details.
50+
///
51+
/// `pad_i32` indicates if a `Reg::i32()` dummy argument is emitted before the real argument.
5152
Cast { pad_i32: bool, cast: Box<CastTarget> },
5253
/// Pass the argument indirectly via a hidden pointer.
54+
///
5355
/// The `meta_attrs` value, if any, is for the metadata (vtable or length) of an unsized
5456
/// argument. (This is the only mode that supports unsized arguments.)
57+
///
5558
/// `on_stack` defines that the value should be passed at a fixed stack offset in accordance to
5659
/// the ABI rather than passed using a pointer. This corresponds to the `byval` LLVM argument
57-
/// attribute (using the Rust type of this argument). `on_stack` cannot be true for unsized
58-
/// arguments, i.e., when `meta_attrs` is `Some`.
60+
/// attribute. The `byval` argument will use a byte array with the same size as the Rust type
61+
/// (which ensures that padding is preserved and that we do not rely on LLVM's struct layout),
62+
/// and will use the alignment specified in `attrs.pointee_align` (if `Some`) or the type's
63+
/// alignment (if `None`). This means that the alignment will not always
64+
/// match the Rust type's alignment; see documentation of `make_indirect_byval` for more info.
65+
///
66+
/// `on_stack` cannot be true for unsized arguments, i.e., when `meta_attrs` is `Some`.
5967
Indirect { attrs: ArgAttributes, meta_attrs: Option<ArgAttributes>, on_stack: bool },
6068
}
6169

@@ -596,6 +604,8 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
596604
}
597605
}
598606

607+
/// Pass this argument indirectly, by passing a (thin or fat) pointer to the argument instead.
608+
/// This is valid for both sized and unsized arguments.
599609
pub fn make_indirect(&mut self) {
600610
match self.mode {
601611
PassMode::Direct(_) | PassMode::Pair(_, _) => {
@@ -609,7 +619,26 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
609619
}
610620
}
611621

622+
/// Pass this argument indirectly, by placing it at a fixed stack offset.
623+
/// This corresponds to the `byval` LLVM argument attribute.
624+
/// This is only valid for sized arguments.
625+
///
626+
/// `byval_align` specifies the alignment of the `byval` stack slot, which does not need to
627+
/// correspond to the type's alignment. This will be `Some` if the target's ABI specifies that
628+
/// stack slots used for arguments passed by-value have specific alignment requirements which
629+
/// differ from the alignment used in other situations.
630+
///
631+
/// If `None`, the type's alignment is used.
632+
///
633+
/// If the resulting alignment differs from the type's alignment,
634+
/// the argument will be copied to an alloca with sufficient alignment,
635+
/// either in the caller (if the type's alignment is lower than the byval alignment)
636+
/// or in the callee† (if the type's alignment is higher than the byval alignment),
637+
/// to ensure that Rust code never sees an underaligned pointer.
638+
///
639+
/// † This is currently broken, see <https://github.com/rust-lang/rust/pull/122212>.
612640
pub fn make_indirect_byval(&mut self, byval_align: Option<Align>) {
641+
assert!(!self.layout.is_unsized(), "used byval ABI for unsized layout");
613642
self.make_indirect();
614643
match self.mode {
615644
PassMode::Indirect { ref mut attrs, meta_attrs: _, ref mut on_stack } => {

compiler/rustc_target/src/abi/call/x86_64.rs

+2
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ where
217217
match cls_or_mem {
218218
Err(Memory) => {
219219
if is_arg {
220+
// The x86_64 ABI doesn't have any special requirements for `byval` alignment,
221+
// the type's alignment is always used.
220222
arg.make_indirect_byval(None);
221223
} else {
222224
// `sret` parameter thus one less integer register available

tests/codegen/align-byval-vector.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ pub struct DoubleFoo {
3737
}
3838

3939
extern "C" {
40-
// x86-linux: declare void @f({{.*}}byval(%Foo) align 4{{.*}})
41-
// x86-darwin: declare void @f({{.*}}byval(%Foo) align 16{{.*}})
40+
// x86-linux: declare void @f({{.*}}byval([32 x i8]) align 4{{.*}})
41+
// x86-darwin: declare void @f({{.*}}byval([32 x i8]) align 16{{.*}})
4242
fn f(foo: Foo);
4343

44-
// x86-linux: declare void @g({{.*}}byval(%DoubleFoo) align 4{{.*}})
45-
// x86-darwin: declare void @g({{.*}}byval(%DoubleFoo) align 16{{.*}})
44+
// x86-linux: declare void @g({{.*}}byval([64 x i8]) align 4{{.*}})
45+
// x86-darwin: declare void @g({{.*}}byval([64 x i8]) align 16{{.*}})
4646
fn g(foo: DoubleFoo);
4747
}
4848

tests/codegen/align-byval.rs

+46-46
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,20 @@ pub unsafe fn call_na1(x: NaturalAlign1) {
107107
// CHECK: start:
108108

109109
// m68k: [[ALLOCA:%[a-z0-9+]]] = alloca %NaturalAlign1, align 1
110-
// m68k: call void @natural_align_1({{.*}}byval(%NaturalAlign1) align 1{{.*}} [[ALLOCA]])
110+
// m68k: call void @natural_align_1({{.*}}byval([2 x i8]) align 1{{.*}} [[ALLOCA]])
111111

112112
// wasm: [[ALLOCA:%[a-z0-9+]]] = alloca %NaturalAlign1, align 1
113-
// wasm: call void @natural_align_1({{.*}}byval(%NaturalAlign1) align 1{{.*}} [[ALLOCA]])
113+
// wasm: call void @natural_align_1({{.*}}byval([2 x i8]) align 1{{.*}} [[ALLOCA]])
114114

115115
// x86_64-linux: call void @natural_align_1(i16
116116

117117
// x86_64-windows: call void @natural_align_1(i16
118118

119119
// i686-linux: [[ALLOCA:%[a-z0-9+]]] = alloca %NaturalAlign1, align 4
120-
// i686-linux: call void @natural_align_1({{.*}}byval(%NaturalAlign1) align 4{{.*}} [[ALLOCA]])
120+
// i686-linux: call void @natural_align_1({{.*}}byval([2 x i8]) align 4{{.*}} [[ALLOCA]])
121121

122122
// i686-windows: [[ALLOCA:%[a-z0-9+]]] = alloca %NaturalAlign1, align 4
123-
// i686-windows: call void @natural_align_1({{.*}}byval(%NaturalAlign1) align 4{{.*}} [[ALLOCA]])
123+
// i686-windows: call void @natural_align_1({{.*}}byval([2 x i8]) align 4{{.*}} [[ALLOCA]])
124124
natural_align_1(x);
125125
}
126126

@@ -135,10 +135,10 @@ pub unsafe fn call_na2(x: NaturalAlign2) {
135135
// x86_64-windows-NEXT: call void @natural_align_2
136136

137137
// i686-linux: [[ALLOCA:%[0-9]+]] = alloca %NaturalAlign2, align 4
138-
// i686-linux: call void @natural_align_2({{.*}}byval(%NaturalAlign2) align 4{{.*}} [[ALLOCA]])
138+
// i686-linux: call void @natural_align_2({{.*}}byval([34 x i8]) align 4{{.*}} [[ALLOCA]])
139139

140140
// i686-windows: [[ALLOCA:%[0-9]+]] = alloca %NaturalAlign2, align 4
141-
// i686-windows: call void @natural_align_2({{.*}}byval(%NaturalAlign2) align 4{{.*}} [[ALLOCA]])
141+
// i686-windows: call void @natural_align_2({{.*}}byval([34 x i8]) align 4{{.*}} [[ALLOCA]])
142142
natural_align_2(x);
143143
}
144144

@@ -199,141 +199,141 @@ pub unsafe fn call_fa16(x: ForceAlign16) {
199199
}
200200

201201
extern "C" {
202-
// m68k: declare void @natural_align_1({{.*}}byval(%NaturalAlign1) align 1{{.*}})
202+
// m68k: declare void @natural_align_1({{.*}}byval([2 x i8]) align 1{{.*}})
203203

204-
// wasm: declare void @natural_align_1({{.*}}byval(%NaturalAlign1) align 1{{.*}})
204+
// wasm: declare void @natural_align_1({{.*}}byval([2 x i8]) align 1{{.*}})
205205

206206
// x86_64-linux: declare void @natural_align_1(i16)
207207

208208
// x86_64-windows: declare void @natural_align_1(i16)
209209

210-
// i686-linux: declare void @natural_align_1({{.*}}byval(%NaturalAlign1) align 4{{.*}})
210+
// i686-linux: declare void @natural_align_1({{.*}}byval([2 x i8]) align 4{{.*}})
211211

212-
// i686-windows: declare void @natural_align_1({{.*}}byval(%NaturalAlign1) align 4{{.*}})
212+
// i686-windows: declare void @natural_align_1({{.*}}byval([2 x i8]) align 4{{.*}})
213213
fn natural_align_1(x: NaturalAlign1);
214214

215-
// m68k: declare void @natural_align_2({{.*}}byval(%NaturalAlign2) align 2{{.*}})
215+
// m68k: declare void @natural_align_2({{.*}}byval([34 x i8]) align 2{{.*}})
216216

217-
// wasm: declare void @natural_align_2({{.*}}byval(%NaturalAlign2) align 2{{.*}})
217+
// wasm: declare void @natural_align_2({{.*}}byval([34 x i8]) align 2{{.*}})
218218

219-
// x86_64-linux: declare void @natural_align_2({{.*}}byval(%NaturalAlign2) align 2{{.*}})
219+
// x86_64-linux: declare void @natural_align_2({{.*}}byval([34 x i8]) align 2{{.*}})
220220

221221
// x86_64-windows: declare void @natural_align_2(
222222
// x86_64-windows-NOT: byval
223223
// x86_64-windows-SAME: align 2{{.*}})
224224

225-
// i686-linux: declare void @natural_align_2({{.*}}byval(%NaturalAlign2) align 4{{.*}})
225+
// i686-linux: declare void @natural_align_2({{.*}}byval([34 x i8]) align 4{{.*}})
226226

227-
// i686-windows: declare void @natural_align_2({{.*}}byval(%NaturalAlign2) align 4{{.*}})
227+
// i686-windows: declare void @natural_align_2({{.*}}byval([34 x i8]) align 4{{.*}})
228228
fn natural_align_2(x: NaturalAlign2);
229229

230-
// m68k: declare void @force_align_4({{.*}}byval(%ForceAlign4) align 4{{.*}})
230+
// m68k: declare void @force_align_4({{.*}}byval([20 x i8]) align 4{{.*}})
231231

232-
// wasm: declare void @force_align_4({{.*}}byval(%ForceAlign4) align 4{{.*}})
232+
// wasm: declare void @force_align_4({{.*}}byval([20 x i8]) align 4{{.*}})
233233

234-
// x86_64-linux: declare void @force_align_4({{.*}}byval(%ForceAlign4) align 4{{.*}})
234+
// x86_64-linux: declare void @force_align_4({{.*}}byval([20 x i8]) align 4{{.*}})
235235

236236
// x86_64-windows: declare void @force_align_4(
237237
// x86_64-windows-NOT: byval
238238
// x86_64-windows-SAME: align 4{{.*}})
239239

240-
// i686-linux: declare void @force_align_4({{.*}}byval(%ForceAlign4) align 4{{.*}})
240+
// i686-linux: declare void @force_align_4({{.*}}byval([20 x i8]) align 4{{.*}})
241241

242-
// i686-windows: declare void @force_align_4({{.*}}byval(%ForceAlign4) align 4{{.*}})
242+
// i686-windows: declare void @force_align_4({{.*}}byval([20 x i8]) align 4{{.*}})
243243
fn force_align_4(x: ForceAlign4);
244244

245-
// m68k: declare void @natural_align_8({{.*}}byval(%NaturalAlign8) align 4{{.*}})
245+
// m68k: declare void @natural_align_8({{.*}}byval([24 x i8]) align 4{{.*}})
246246

247-
// wasm: declare void @natural_align_8({{.*}}byval(%NaturalAlign8) align 8{{.*}})
247+
// wasm: declare void @natural_align_8({{.*}}byval([24 x i8]) align 8{{.*}})
248248

249-
// x86_64-linux: declare void @natural_align_8({{.*}}byval(%NaturalAlign8) align 8{{.*}})
249+
// x86_64-linux: declare void @natural_align_8({{.*}}byval([24 x i8]) align 8{{.*}})
250250

251251
// x86_64-windows: declare void @natural_align_8(
252252
// x86_64-windows-NOT: byval
253253
// x86_64-windows-SAME: align 8{{.*}})
254254

255-
// i686-linux: declare void @natural_align_8({{.*}}byval(%NaturalAlign8) align 4{{.*}})
255+
// i686-linux: declare void @natural_align_8({{.*}}byval([24 x i8]) align 4{{.*}})
256256

257-
// i686-windows: declare void @natural_align_8({{.*}}byval(%NaturalAlign8) align 4{{.*}})
257+
// i686-windows: declare void @natural_align_8({{.*}}byval([24 x i8]) align 4{{.*}})
258258
fn natural_align_8(x: NaturalAlign8);
259259

260-
// m68k: declare void @force_align_8({{.*}}byval(%ForceAlign8) align 8{{.*}})
260+
// m68k: declare void @force_align_8({{.*}}byval([24 x i8]) align 8{{.*}})
261261

262-
// wasm: declare void @force_align_8({{.*}}byval(%ForceAlign8) align 8{{.*}})
262+
// wasm: declare void @force_align_8({{.*}}byval([24 x i8]) align 8{{.*}})
263263

264-
// x86_64-linux: declare void @force_align_8({{.*}}byval(%ForceAlign8) align 8{{.*}})
264+
// x86_64-linux: declare void @force_align_8({{.*}}byval([24 x i8]) align 8{{.*}})
265265

266266
// x86_64-windows: declare void @force_align_8(
267267
// x86_64-windows-NOT: byval
268268
// x86_64-windows-SAME: align 8{{.*}})
269269

270-
// i686-linux: declare void @force_align_8({{.*}}byval(%ForceAlign8) align 4{{.*}})
270+
// i686-linux: declare void @force_align_8({{.*}}byval([24 x i8]) align 4{{.*}})
271271

272272
// i686-windows: declare void @force_align_8(
273273
// i686-windows-NOT: byval
274274
// i686-windows-SAME: align 8{{.*}})
275275
fn force_align_8(x: ForceAlign8);
276276

277-
// m68k: declare void @lower_fa8({{.*}}byval(%LowerFA8) align 4{{.*}})
277+
// m68k: declare void @lower_fa8({{.*}}byval([24 x i8]) align 4{{.*}})
278278

279-
// wasm: declare void @lower_fa8({{.*}}byval(%LowerFA8) align 8{{.*}})
279+
// wasm: declare void @lower_fa8({{.*}}byval([24 x i8]) align 8{{.*}})
280280

281-
// x86_64-linux: declare void @lower_fa8({{.*}}byval(%LowerFA8) align 8{{.*}})
281+
// x86_64-linux: declare void @lower_fa8({{.*}}byval([24 x i8]) align 8{{.*}})
282282

283283
// x86_64-windows: declare void @lower_fa8(
284284
// x86_64-windows-NOT: byval
285285
// x86_64-windows-SAME: align 8{{.*}})
286286

287-
// i686-linux: declare void @lower_fa8({{.*}}byval(%LowerFA8) align 4{{.*}})
287+
// i686-linux: declare void @lower_fa8({{.*}}byval([24 x i8]) align 4{{.*}})
288288

289-
// i686-windows: declare void @lower_fa8({{.*}}byval(%LowerFA8) align 4{{.*}})
289+
// i686-windows: declare void @lower_fa8({{.*}}byval([24 x i8]) align 4{{.*}})
290290
fn lower_fa8(x: LowerFA8);
291291

292-
// m68k: declare void @wrapped_fa8({{.*}}byval(%WrappedFA8) align 8{{.*}})
292+
// m68k: declare void @wrapped_fa8({{.*}}byval([24 x i8]) align 8{{.*}})
293293

294-
// wasm: declare void @wrapped_fa8({{.*}}byval(%WrappedFA8) align 8{{.*}})
294+
// wasm: declare void @wrapped_fa8({{.*}}byval([24 x i8]) align 8{{.*}})
295295

296-
// x86_64-linux: declare void @wrapped_fa8({{.*}}byval(%WrappedFA8) align 8{{.*}})
296+
// x86_64-linux: declare void @wrapped_fa8({{.*}}byval([24 x i8]) align 8{{.*}})
297297

298298
// x86_64-windows: declare void @wrapped_fa8(
299299
// x86_64-windows-NOT: byval
300300
// x86_64-windows-SAME: align 8{{.*}})
301301

302-
// i686-linux: declare void @wrapped_fa8({{.*}}byval(%WrappedFA8) align 4{{.*}})
302+
// i686-linux: declare void @wrapped_fa8({{.*}}byval([24 x i8]) align 4{{.*}})
303303

304304
// i686-windows: declare void @wrapped_fa8(
305305
// i686-windows-NOT: byval
306306
// i686-windows-SAME: align 8{{.*}})
307307
fn wrapped_fa8(x: WrappedFA8);
308308

309-
// m68k: declare void @transparent_fa8({{.*}}byval(%TransparentFA8) align 8{{.*}})
309+
// m68k: declare void @transparent_fa8({{.*}}byval([24 x i8]) align 8{{.*}})
310310

311-
// wasm: declare void @transparent_fa8({{.*}}byval(%TransparentFA8) align 8{{.*}})
311+
// wasm: declare void @transparent_fa8({{.*}}byval([24 x i8]) align 8{{.*}})
312312

313-
// x86_64-linux: declare void @transparent_fa8({{.*}}byval(%TransparentFA8) align 8{{.*}})
313+
// x86_64-linux: declare void @transparent_fa8({{.*}}byval([24 x i8]) align 8{{.*}})
314314

315315
// x86_64-windows: declare void @transparent_fa8(
316316
// x86_64-windows-NOT: byval
317317
// x86_64-windows-SAME: align 8{{.*}})
318318

319-
// i686-linux: declare void @transparent_fa8({{.*}}byval(%TransparentFA8) align 4{{.*}})
319+
// i686-linux: declare void @transparent_fa8({{.*}}byval([24 x i8]) align 4{{.*}})
320320

321321
// i686-windows: declare void @transparent_fa8(
322322
// i686-windows-NOT: byval
323323
// i686-windows-SAME: align 8{{.*}})
324324
fn transparent_fa8(x: TransparentFA8);
325325

326-
// m68k: declare void @force_align_16({{.*}}byval(%ForceAlign16) align 16{{.*}})
326+
// m68k: declare void @force_align_16({{.*}}byval([80 x i8]) align 16{{.*}})
327327

328-
// wasm: declare void @force_align_16({{.*}}byval(%ForceAlign16) align 16{{.*}})
328+
// wasm: declare void @force_align_16({{.*}}byval([80 x i8]) align 16{{.*}})
329329

330-
// x86_64-linux: declare void @force_align_16({{.*}}byval(%ForceAlign16) align 16{{.*}})
330+
// x86_64-linux: declare void @force_align_16({{.*}}byval([80 x i8]) align 16{{.*}})
331331

332332
// x86_64-windows: declare void @force_align_16(
333333
// x86_64-windows-NOT: byval
334334
// x86_64-windows-SAME: align 16{{.*}})
335335

336-
// i686-linux: declare void @force_align_16({{.*}}byval(%ForceAlign16) align 4{{.*}})
336+
// i686-linux: declare void @force_align_16({{.*}}byval([80 x i8]) align 4{{.*}})
337337

338338
// i686-windows: declare void @force_align_16(
339339
// i686-windows-NOT: byval

tests/codegen/align-enum.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pub enum Align64 {
88
A(u32),
99
B(u32),
1010
}
11-
// CHECK: %Align64 = type { i32, [15 x i32] }
1211

1312
pub struct Nested64 {
1413
a: u8,

tests/codegen/align-struct.rs

-4
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,23 @@
55

66
#[repr(align(64))]
77
pub struct Align64(i32);
8-
// CHECK: %Align64 = type { i32, [15 x i32] }
98

109
pub struct Nested64 {
1110
a: Align64,
1211
b: i32,
1312
c: i32,
1413
d: i8,
1514
}
16-
// CHECK: %Nested64 = type { %Align64, i32, i32, i8, [55 x i8] }
1715

1816
pub enum Enum4 {
1917
A(i32),
2018
B(i32),
2119
}
22-
// No Aggregate type, and hence nothing in LLVM IR.
2320

2421
pub enum Enum64 {
2522
A(Align64),
2623
B(i32),
2724
}
28-
// CHECK: %Enum64 = type { i32, [31 x i32] }
2925

3026
// CHECK-LABEL: @align64
3127
#[no_mangle]

0 commit comments

Comments
 (0)