@@ -7,9 +7,9 @@ use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}
77use rustc_middle:: mir:: mono:: MonoItem ;
88use rustc_middle:: ty:: { self , Instance , Ty } ;
99use rustc_middle:: ty:: layout:: LayoutOf ;
10- use rustc_middle:: mir:: interpret:: { self , ConstAllocation , ErrorHandled , GlobalAlloc , Scalar as InterpScalar , read_target_uint} ;
10+ use rustc_middle:: mir:: interpret:: { self , ConstAllocation , ErrorHandled , Scalar as InterpScalar , read_target_uint} ;
1111use rustc_span:: def_id:: DefId ;
12- use rustc_target:: abi:: { self , AddressSpace , Align , HasDataLayout , Primitive , Size , WrappingRange } ;
12+ use rustc_target:: abi:: { self , Align , HasDataLayout , Primitive , Size , WrappingRange } ;
1313
1414use crate :: base;
1515use crate :: context:: CodegenCx ;
@@ -323,12 +323,7 @@ pub fn const_alloc_to_gcc<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, alloc: ConstAl
323323 . expect ( "const_alloc_to_llvm: could not read relocation pointer" )
324324 as u64 ;
325325
326- let address_space = match cx. tcx . global_alloc ( alloc_id) {
327- GlobalAlloc :: Function ( ..) => cx. data_layout ( ) . instruction_address_space ,
328- GlobalAlloc :: Static ( ..) | GlobalAlloc :: Memory ( ..) | GlobalAlloc :: VTable ( ..) => {
329- AddressSpace :: DATA
330- }
331- } ;
326+ let address_space = cx. tcx . global_alloc ( alloc_id) . address_space ( cx) ;
332327
333328 llvals. push ( cx. scalar_to_backend (
334329 InterpScalar :: from_pointer (
0 commit comments