Skip to content

Commit dfcd0db

Browse files
committed
do not set the attributes quite as often
1 parent 96e9134 commit dfcd0db

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
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
});

tests/codegen/cffi/ffi-out-of-bounds-loads.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ revisions: linux apple
22
//@ min-llvm-version: 19
3-
//@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error
3+
//@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes -Zlint-llvm-ir
44

55
//@[linux] compile-flags: --target x86_64-unknown-linux-gnu
66
//@[linux] needs-llvm-components: x86

0 commit comments

Comments
 (0)