Skip to content

Commit d41deaa

Browse files
authored
Unrolled build for #160454
Rollup merge of #160454 - Sa4dUs:offload-fix-perf, r=ZuseZ4 Add offload guard flags to typeck to prevent perf regressions Fixes perf regression in #158693 r? @ZuseZ4
2 parents 0b63def + e04a81f commit d41deaa

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
631631
// be known if explicitly specified via turbofish).
632632
self.deferred_transmute_checks.borrow_mut().push((*from, to, expr.hir_id));
633633
}
634-
if tcx.is_intrinsic(did, sym::offload) {
634+
if !tcx.sess.opts.unstable_opts.offload.is_empty()
635+
&& tcx.is_intrinsic(did, sym::offload)
636+
{
635637
let args = args.skip_binder();
636638
let f = args.type_at(0);
637639
let t = args.type_at(1);

compiler/rustc_interface/src/passes.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,9 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
11541154
if not_typeck_child {
11551155
tcx.ensure_ok().mir_borrowck(def_id);
11561156
tcx.ensure_ok().check_transmutes(def_id);
1157-
tcx.ensure_ok().check_offloads(def_id);
1157+
if !tcx.sess.opts.unstable_opts.offload.is_empty() {
1158+
tcx.ensure_ok().check_offloads(def_id);
1159+
}
11581160
}
11591161
tcx.ensure_ok().has_ffi_unwind_calls(def_id);
11601162
tcx.ensure_ok().check_liveness(def_id);

compiler/rustc_middle/src/queries.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ rustc_queries! {
11351135
desc { "check transmute calls inside `{}`", tcx.def_path_str(key) }
11361136
}
11371137

1138-
/// Unsafety-check this `LocalDefId`.
1138+
/// Type-check offloads calls given a typeck root
11391139
query check_offloads(key: LocalDefId) -> Result<(), ErrorGuaranteed> {
11401140
desc { "check offload calls inside `{}`", tcx.def_path_str(key) }
11411141
}

0 commit comments

Comments
 (0)