Browse Source

Cranelift: Remove duplicate IR signature legalizations (#5093)

The `SigData::from_func_sig` constructor will already ensure that the struct
return pointer is returned, so this is a purely unnecessary call.

Note that this is not a performance speed up, since
`ensure_struct_return_ptr_is_returned` doesn't do any significant work if the
signature is already legalized.
pull/5095/head
Nick Fitzgerald 2 years ago
committed by GitHub
parent
commit
4a66c3b855
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      cranelift/codegen/src/machinst/abi.rs

6
cranelift/codegen/src/machinst/abi.rs

@ -773,8 +773,7 @@ impl SigSet {
// `ir::Signature`. // `ir::Signature`.
debug_assert!(!self.have_abi_sig_for_signature(&signature)); debug_assert!(!self.have_abi_sig_for_signature(&signature));
let legalized_signature = crate::machinst::ensure_struct_return_ptr_is_returned(&signature); let sig_data = SigData::from_func_sig::<M>(&signature, flags)?;
let sig_data = SigData::from_func_sig::<M>(&legalized_signature, flags)?;
let sig = self.sigs.push(sig_data); let sig = self.sigs.push(sig_data);
self.ir_signature_to_abi_sig.insert(signature, sig); self.ir_signature_to_abi_sig.insert(signature, sig);
Ok(sig) Ok(sig)
@ -793,8 +792,7 @@ impl SigSet {
return Ok(sig); return Ok(sig);
} }
let signature = &dfg.signatures[sig_ref]; let signature = &dfg.signatures[sig_ref];
let legalized_signature = crate::machinst::ensure_struct_return_ptr_is_returned(&signature); let sig_data = SigData::from_func_sig::<M>(signature, flags)?;
let sig_data = SigData::from_func_sig::<M>(&legalized_signature, flags)?;
let sig = self.sigs.push(sig_data); let sig = self.sigs.push(sig_data);
self.ir_sig_ref_to_abi_sig[sig_ref] = Some(sig); self.ir_sig_ref_to_abi_sig[sig_ref] = Some(sig);
Ok(sig) Ok(sig)

Loading…
Cancel
Save