Skip to content

Commit 24f271d

Browse files
committed
do not set the attributes quite as often
1 parent ca3dc99 commit 24f271d

File tree

1 file changed

+6
-1
lines changed
  • compiler/rustc_codegen_llvm/src

1 file changed

+6
-1
lines changed

compiler/rustc_codegen_llvm/src/abi.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,12 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
663663
}
664664

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

0 commit comments

Comments
 (0)