Skip to content

Commit

Permalink
do not set the attributes quite as often
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Sep 4, 2024
1 parent ca3dc99 commit 24f271d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compiler/rustc_codegen_llvm/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,12 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
}

// If the call site has an associated instance, compute extra attributes based on that.
if let Some(instance) = instance {
// However, only do that for calls to imported functions: all the others have these
// attributes applied already to the declaration, so we can save some work by not also
// applying them here (and this really shows in perf).
if let Some(instance) = instance
&& bx.tcx.is_foreign_item(instance.def_id())
{
llfn_attrs_from_instance(bx.cx, instance, None, |place, attrs| {
attributes::apply_to_callsite(callsite, place, attrs)
});
Expand Down

0 comments on commit 24f271d

Please sign in to comment.