Skip to content

Commit 5c4b797

Browse files
committed
Use layout field of OperandRef and PlaceRef in codegen_intrinsic_call
This avoids having to get the function signature.
1 parent acb2fcd commit 5c4b797

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/intrinsic/mod.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,9 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
212212
_ => bug!("expected fn item type, found {}", callee_ty),
213213
};
214214

215-
let sig = callee_ty.fn_sig(tcx);
216-
let sig = tcx.normalize_erasing_late_bound_regions(self.typing_env(), sig);
217-
let arg_tys = sig.inputs();
218-
let ret_ty = sig.output();
219215
let name = tcx.item_name(def_id);
220216
let name_str = name.as_str();
221217

222-
let llret_ty = self.layout_of(ret_ty).gcc_type(self);
223-
224218
let simple = get_simple_intrinsic(self, name);
225219
let simple_func = get_simple_function(self, name);
226220

@@ -320,8 +314,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
320314
| sym::rotate_right
321315
| sym::saturating_add
322316
| sym::saturating_sub => {
323-
let ty = arg_tys[0];
324-
match int_type_width_signed(ty, self) {
317+
match int_type_width_signed(args[0].layout.ty, self) {
325318
Some((width, signed)) => match name {
326319
sym::ctlz | sym::cttz => {
327320
let func = self.current_func.borrow().expect("func");
@@ -400,7 +393,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
400393
tcx.dcx().emit_err(InvalidMonomorphization::BasicIntegerType {
401394
span,
402395
name,
403-
ty,
396+
ty: args[0].layout.ty,
404397
});
405398
return Ok(());
406399
}
@@ -492,7 +485,15 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
492485
}
493486

494487
_ if name_str.starts_with("simd_") => {
495-
match generic_simd_intrinsic(self, name, callee_ty, args, ret_ty, llret_ty, span) {
488+
match generic_simd_intrinsic(
489+
self,
490+
name,
491+
callee_ty,
492+
args,
493+
result.layout.ty,
494+
result.layout.gcc_type(self),
495+
span,
496+
) {
496497
Ok(value) => value,
497498
Err(()) => return Ok(()),
498499
}

0 commit comments

Comments
 (0)