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 d5d33c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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
2 changes: 1 addition & 1 deletion tests/codegen/cffi/ffi-out-of-bounds-loads.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ revisions: linux apple
//@ min-llvm-version: 19
//@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error
//@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes -Zlint-llvm-ir

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

0 comments on commit d5d33c1

Please sign in to comment.