File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -200,11 +200,15 @@ pub(crate) fn codegen_const_value<'tcx>(
200
200
CValue :: by_val ( val, layout)
201
201
}
202
202
} ,
203
- ConstValue :: ByRef { alloc, offset } => CValue :: by_ref (
204
- pointer_for_allocation ( fx, alloc)
205
- . offset_i64 ( fx, i64:: try_from ( offset. bytes ( ) ) . unwrap ( ) ) ,
206
- layout,
207
- ) ,
203
+ ConstValue :: ByRef { alloc_id, offset } => {
204
+ let alloc = fx. tcx . global_alloc ( alloc_id) . unwrap_memory ( ) ;
205
+ // FIXME: avoid creating multiple allocations for the same AllocId?
206
+ CValue :: by_ref (
207
+ pointer_for_allocation ( fx, alloc)
208
+ . offset_i64 ( fx, i64:: try_from ( offset. bytes ( ) ) . unwrap ( ) ) ,
209
+ layout,
210
+ )
211
+ }
208
212
ConstValue :: Slice { data, start, end } => {
209
213
let ptr = pointer_for_allocation ( fx, data)
210
214
. offset_i64 ( fx, i64:: try_from ( start) . unwrap ( ) )
Original file line number Diff line number Diff line change @@ -172,7 +172,8 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
172
172
. expect ( "simd_shuffle idx not const" ) ;
173
173
174
174
let idx_bytes = match idx_const {
175
- ConstValue :: ByRef { alloc, offset } => {
175
+ ConstValue :: ByRef { alloc_id, offset } => {
176
+ let alloc = fx. tcx . global_alloc ( alloc_id) . unwrap_memory ( ) ;
176
177
let size = Size :: from_bytes (
177
178
4 * ret_lane_count, /* size_of([u32; ret_lane_count]) */
178
179
) ;
You can’t perform that action at this time.
0 commit comments