@@ -13,17 +13,15 @@ use rustc_codegen_ssa::traits::*;
13
13
use rustc_hir:: def_id:: DefId ;
14
14
use rustc_middle:: middle:: codegen_fn_attrs:: { CodegenFnAttrFlags , CodegenFnAttrs } ;
15
15
use rustc_middle:: mir:: interpret:: {
16
- read_target_uint, Allocation , ConstAllocation , ErrorHandled , GlobalAlloc , InitChunk , Pointer ,
16
+ read_target_uint, Allocation , ConstAllocation , ErrorHandled , InitChunk , Pointer ,
17
17
Scalar as InterpScalar ,
18
18
} ;
19
19
use rustc_middle:: mir:: mono:: MonoItem ;
20
20
use rustc_middle:: ty:: layout:: LayoutOf ;
21
21
use rustc_middle:: ty:: { self , Instance , Ty } ;
22
22
use rustc_middle:: { bug, span_bug} ;
23
23
use rustc_session:: config:: Lto ;
24
- use rustc_target:: abi:: {
25
- AddressSpace , Align , HasDataLayout , Primitive , Scalar , Size , WrappingRange ,
26
- } ;
24
+ use rustc_target:: abi:: { Align , HasDataLayout , Primitive , Scalar , Size , WrappingRange } ;
27
25
use std:: ops:: Range ;
28
26
29
27
pub fn const_alloc_to_llvm < ' ll > ( cx : & CodegenCx < ' ll , ' _ > , alloc : ConstAllocation < ' _ > ) -> & ' ll Value {
@@ -98,12 +96,7 @@ pub fn const_alloc_to_llvm<'ll>(cx: &CodegenCx<'ll, '_>, alloc: ConstAllocation<
98
96
. expect ( "const_alloc_to_llvm: could not read relocation pointer" )
99
97
as u64 ;
100
98
101
- let address_space = match cx. tcx . global_alloc ( alloc_id) {
102
- GlobalAlloc :: Function ( ..) => cx. data_layout ( ) . instruction_address_space ,
103
- GlobalAlloc :: Static ( ..) | GlobalAlloc :: Memory ( ..) | GlobalAlloc :: VTable ( ..) => {
104
- AddressSpace :: DATA
105
- }
106
- } ;
99
+ let address_space = cx. tcx . global_alloc ( alloc_id) . address_space ( cx) ;
107
100
108
101
llvals. push ( cx. scalar_to_backend (
109
102
InterpScalar :: from_pointer (
0 commit comments