10BC0 Auto merge of #145910 - saethlin:ignore-intrinsic-calls, r=<try> · rust-lang/rust@c3f0a64 · GitHub
[go: up one dir, main page]

Skip to content

Commit c3f0a64

Browse files
Auto merge of #145910 - saethlin:ignore-intrinsic-calls, r=<try>
Ignore intrinsic calls in cross-crate-inlining cost model
2 parents 51ff895 + 5dc2b2e commit c3f0a64

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

compiler/rustc_mir_transform/src/cross_crate_inline.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,12 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> {
135135
}
136136
}
137137
}
138-
TerminatorKind::Call { unwind, .. } => {
138+
TerminatorKind::Call { ref func, unwind, .. } => {
139+
if let Some((fn_def_id, _)) = func.const_fn_def() {
140+
if self.tcx.has_attr(fn_def_id, sym::rustc_intrinsic) {
141+
return;
142+
}
143+
}
139144
self.calls += 1;
140145
if let UnwindAction::Cleanup(_) = unwind {
141146
self.landing_pads += 1;

compiler/rustc_monomorphize/src/partitioning.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ where
164164
// Merge until we don't exceed the max CGU count.
165165
// `merge_codegen_units` is responsible for updating the CGU size
166166
// estimates.
167-
{
167+
if tcx.sess.opts.incremental.is_none() {
168168
let _prof_timer = tcx.prof.generic_activity("cgu_partitioning_merge_cgus");
169169
merge_codegen_units(cx, &mut codegen_units);
170170
debug_dump(tcx, "MERGE", &codegen_units);

tests/assembly-llvm/breakpoint.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// CHECK-LABEL: use_bp
1010
// aarch64: brk #0xf000
1111
// x86_64: int3
12+
#[inline(never)]
1213
pub fn use_bp() {
1314
core::arch::breakpoint();
1415
}

tests/assembly-llvm/simd/reduce-fadd-unordered.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use std::simd::*;
1616
// It would emit about an extra fadd, depending on the architecture.
1717

1818
// CHECK-LABEL: reduce_fadd_negative_zero
19+
#[inline(never)]
1920
pub unsafe fn reduce_fadd_negative_zero(v: f32x4) -> f32 {
2021
// x86_64: addps
2122
// x86_64-NEXT: movshdup

tests/codegen-llvm/default-visibility.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub static tested_symbol: [u8; 6] = *b"foobar";
3232
// INTERPOSABLE: @{{.*}}default_visibility{{.*}}tested_symbol{{.*}} = constant
3333
// DEFAULT: @{{.*}}default_visibility{{.*}}tested_symbol{{.*}} = constant
3434

35+
#[inline(never)]
3536
pub fn do_memcmp(left: &[u8], right: &[u8]) -> i32 {
3637
left.cmp(right) as i32
3738
}

0 commit comments

Comments
 (0)
0