@@ -13,17 +13,15 @@ use rustc_codegen_ssa::traits::*;
1313use rustc_hir:: def_id:: DefId ;
1414use rustc_middle:: middle:: codegen_fn_attrs:: { CodegenFnAttrFlags , CodegenFnAttrs } ;
1515use rustc_middle:: mir:: interpret:: {
16- read_target_uint, Allocation , ConstAllocation , ErrorHandled , GlobalAlloc , InitChunk , Pointer ,
16+ read_target_uint, Allocation , ConstAllocation , ErrorHandled , InitChunk , Pointer ,
1717 Scalar as InterpScalar ,
1818} ;
1919use rustc_middle:: mir:: mono:: MonoItem ;
2020use rustc_middle:: ty:: layout:: LayoutOf ;
2121use rustc_middle:: ty:: { self , Instance , Ty } ;
2222use rustc_middle:: { bug, span_bug} ;
2323use 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 } ;
2725use std:: ops:: Range ;
2826
2927pub 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<
9896 . expect ( "const_alloc_to_llvm: could not read relocation pointer" )
9997 as u64 ;
10098
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) ;
107100
108101 llvals. push ( cx. scalar_to_backend (
109102 InterpScalar :: from_pointer (
0 commit comments