mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-25 14:13:38 +00:00
Auto merge of #47401 - rkruppe:issue-47278, r=eddyb
Compute LLVM argument indices correctly in face of padding Closes #47278 r? @eddyb
This commit is contained in:
commit
9af8d42ec7
@ -608,9 +608,6 @@ impl<'a, 'tcx> ArgType<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn store_fn_arg(&self, bx: &Builder<'a, 'tcx>, idx: &mut usize, dst: PlaceRef<'tcx>) {
|
pub fn store_fn_arg(&self, bx: &Builder<'a, 'tcx>, idx: &mut usize, dst: PlaceRef<'tcx>) {
|
||||||
if self.pad.is_some() {
|
|
||||||
*idx += 1;
|
|
||||||
}
|
|
||||||
let mut next = || {
|
let mut next = || {
|
||||||
let val = llvm::get_param(bx.llfn(), *idx as c_uint);
|
let val = llvm::get_param(bx.llfn(), *idx as c_uint);
|
||||||
*idx += 1;
|
*idx += 1;
|
||||||
|
@ -402,6 +402,9 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
|||||||
for i in 0..tupled_arg_tys.len() {
|
for i in 0..tupled_arg_tys.len() {
|
||||||
let arg = &fx.fn_ty.args[idx];
|
let arg = &fx.fn_ty.args[idx];
|
||||||
idx += 1;
|
idx += 1;
|
||||||
|
if arg.pad.is_some() {
|
||||||
|
llarg_idx += 1;
|
||||||
|
}
|
||||||
arg.store_fn_arg(bx, &mut llarg_idx, place.project_field(bx, i));
|
arg.store_fn_arg(bx, &mut llarg_idx, place.project_field(bx, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
19
src/test/codegen/issue-47278.rs
Normal file
19
src/test/codegen/issue-47278.rs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
// -C no-prepopulate-passes
|
||||||
|
#![crate_type="staticlib"]
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct Foo(u64);
|
||||||
|
|
||||||
|
// CHECK: define {{.*}} @foo(
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern fn foo(_: Foo) -> Foo { loop {} }
|
Loading…
Reference in New Issue
Block a user