Revert part of pr50949 for LLVM5
This commit is contained in:
parent
d01c400c6d
commit
4b19ef4596
|
@ -0,0 +1,62 @@
|
||||||
|
From da579ef75e4a8ca11fb98b24a0a3ea0c7ccffeeb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Eduard-Mihai Burtescu <edy.burt@gmail.com>
|
||||||
|
Date: Mon, 21 May 2018 20:38:41 +0300
|
||||||
|
Subject: [PATCH] rustc_codegen_llvm: remove closure env alloca hack around
|
||||||
|
upvar debuginfo.
|
||||||
|
|
||||||
|
---
|
||||||
|
src/librustc_codegen_llvm/mir/mod.rs | 24 ++----------------------
|
||||||
|
1 file changed, 2 insertions(+), 22 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/librustc_codegen_llvm/mir/mod.rs b/src/librustc_codegen_llvm/mir/mod.rs
|
||||||
|
index a91a6e251aa7..d34f881bf9dd 100644
|
||||||
|
--- a/src/librustc_codegen_llvm/mir/mod.rs
|
||||||
|
+++ b/src/librustc_codegen_llvm/mir/mod.rs
|
||||||
|
@@ -583,23 +583,6 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
||||||
|
};
|
||||||
|
let upvar_tys = upvar_substs.upvar_tys(def_id, tcx);
|
||||||
|
|
||||||
|
- // Store the pointer to closure data in an alloca for debuginfo
|
||||||
|
- // because that's what the llvm.dbg.declare intrinsic expects.
|
||||||
|
-
|
||||||
|
- // FIXME(eddyb) this shouldn't be necessary but SROA seems to
|
||||||
|
- // mishandle DW_OP_plus not preceded by DW_OP_deref, i.e. it
|
||||||
|
- // doesn't actually strip the offset when splitting the closure
|
||||||
|
- // environment into its components so it ends up out of bounds.
|
||||||
|
- let env_ptr = if !env_ref {
|
||||||
|
- let scratch = PlaceRef::alloca(bx,
|
||||||
|
- bx.cx.layout_of(tcx.mk_mut_ptr(arg.layout.ty)),
|
||||||
|
- "__debuginfo_env_ptr");
|
||||||
|
- bx.store(place.llval, scratch.llval, scratch.align);
|
||||||
|
- scratch.llval
|
||||||
|
- } else {
|
||||||
|
- place.llval
|
||||||
|
- };
|
||||||
|
-
|
||||||
|
for (i, (decl, ty)) in mir.upvar_decls.iter().zip(upvar_tys).enumerate() {
|
||||||
|
let byte_offset_of_var_in_env = closure_layout.fields.offset(i).bytes();
|
||||||
|
|
||||||
|
@@ -611,10 +594,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
||||||
|
};
|
||||||
|
|
||||||
|
// The environment and the capture can each be indirect.
|
||||||
|
-
|
||||||
|
- // FIXME(eddyb) see above why we have to keep
|
||||||
|
- // a pointer in an alloca for debuginfo atm.
|
||||||
|
- let mut ops = if env_ref || true { &ops[..] } else { &ops[1..] };
|
||||||
|
+ let mut ops = if env_ref { &ops[..] } else { &ops[1..] };
|
||||||
|
|
||||||
|
let ty = if let (true, &ty::TyRef(_, ty, _)) = (decl.by_ref, &ty.sty) {
|
||||||
|
ty
|
||||||
|
@@ -624,7 +604,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
||||||
|
};
|
||||||
|
|
||||||
|
let variable_access = VariableAccess::IndirectVariable {
|
||||||
|
- alloca: env_ptr,
|
||||||
|
+ alloca: place.llval,
|
||||||
|
address_operations: &ops
|
||||||
|
};
|
||||||
|
declare_local(
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -76,6 +76,11 @@ Patch1: rust-52760-test_loading_atoi.patch
|
||||||
# https://github.com/rust-lang/rust/pull/52876
|
# https://github.com/rust-lang/rust/pull/52876
|
||||||
Patch2: rust-52876-const-endianess.patch
|
Patch2: rust-52876-const-endianess.patch
|
||||||
|
|
||||||
|
# https://github.com/rust-lang/rust/issues/53204
|
||||||
|
# From https://github.com/rust-lang/rust/pull/50949
|
||||||
|
# This second commit causes problems with LLVM 5 debuginfo -- reverting.
|
||||||
|
Patch3: 0001-rustc_codegen_llvm-remove-closure-env-alloca-hack-ar.patch
|
||||||
|
|
||||||
# Get the Rust triple for any arch.
|
# Get the Rust triple for any arch.
|
||||||
%{lua: function rust_triple(arch)
|
%{lua: function rust_triple(arch)
|
||||||
local abi = "gnu"
|
local abi = "gnu"
|
||||||
|
@ -377,6 +382,8 @@ test -f '%{local_rust_root}/bin/rustc'
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
|
|
||||||
|
%patch3 -p1 -R
|
||||||
|
|
||||||
%if "%{python}" == "python3"
|
%if "%{python}" == "python3"
|
||||||
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure
|
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure
|
||||||
%endif
|
%endif
|
||||||
|
|
Loading…
Reference in New Issue