@@ -299,27 +299,9 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
299
299
index : usize ,
300
300
immediate : bool ,
301
301
) -> & ' a Type {
302
- // HACK(eddyb) special-case fat pointers until LLVM removes
303
- // pointee types, to avoid bitcasting every `OperandRef::deref`.
304
- match * self . ty . kind ( ) {
305
- ty:: Ref ( ..) | ty:: RawPtr ( _) => {
306
- return self . field ( cx, index) . llvm_type ( cx) ;
307
- }
308
- // only wide pointer boxes are handled as pointers
309
- // thin pointer boxes with scalar allocators are handled by the general logic below
310
- ty:: Adt ( def, args) if def. is_box ( ) && cx. layout_of ( args. type_at ( 1 ) ) . is_zst ( ) => {
311
- let ptr_ty = Ty :: new_mut_ptr ( cx. tcx , self . ty . boxed_ty ( ) ) ;
312
- return cx. layout_of ( ptr_ty) . scalar_pair_element_llvm_type ( cx, index, immediate) ;
313
- }
314
- // `dyn* Trait` has the same ABI as `*mut dyn Trait`
315
- ty:: Dynamic ( bounds, region, ty:: DynStar ) => {
316
- let ptr_ty =
317
- Ty :: new_mut_ptr ( cx. tcx , Ty :: new_dynamic ( cx. tcx , bounds, region, ty:: Dyn ) ) ;
318
- return cx. layout_of ( ptr_ty) . scalar_pair_element_llvm_type ( cx, index, immediate) ;
319
- }
320
- _ => { }
321
- }
322
-
302
+ // This must produce the same result for `repr(transparent)` wrappers as for the inner type!
303
+ // In other words, this should generally not look at the type at all, but only at the
304
+ // layout.
323
305
let Abi :: ScalarPair ( a, b) = self . abi else {
324
306
bug ! ( "TyAndLayout::scalar_pair_element_llty({:?}): not applicable" , self ) ;
325
307
} ;
0 commit comments