rustc_codegen_ssa: cleanup nested if
s and a needless match
This commit is contained in:
parent
c930bb2cfb
commit
9e5e6a9d0f
4 changed files with 24 additions and 28 deletions
|
@ -626,10 +626,9 @@ fn link_staticlib(
|
||||||
|
|
||||||
let mut all_rust_dylibs = vec![];
|
let mut all_rust_dylibs = vec![];
|
||||||
for &cnum in crates {
|
for &cnum in crates {
|
||||||
match fmts.get(cnum) {
|
let Some(Linkage::Dynamic) = fmts.get(cnum) else {
|
||||||
Some(&Linkage::Dynamic) => {}
|
continue;
|
||||||
_ => continue,
|
};
|
||||||
}
|
|
||||||
let crate_name = codegen_results.crate_info.crate_name[&cnum];
|
let crate_name = codegen_results.crate_info.crate_name[&cnum];
|
||||||
let used_crate_source = &codegen_results.crate_info.used_crate_source[&cnum];
|
let used_crate_source = &codegen_results.crate_info.used_crate_source[&cnum];
|
||||||
if let Some((path, _)) = &used_crate_source.dylib {
|
if let Some((path, _)) = &used_crate_source.dylib {
|
||||||
|
|
|
@ -1537,8 +1537,9 @@ fn start_executing_work<B: ExtraBackendMethods>(
|
||||||
// Spin up what work we can, only doing this while we've got available
|
// Spin up what work we can, only doing this while we've got available
|
||||||
// parallelism slots and work left to spawn.
|
// parallelism slots and work left to spawn.
|
||||||
if codegen_state != Aborted {
|
if codegen_state != Aborted {
|
||||||
while !work_items.is_empty() && running_with_own_token < tokens.len() {
|
while running_with_own_token < tokens.len()
|
||||||
let (item, _) = work_items.pop().unwrap();
|
&& let Some((item, _)) = work_items.pop()
|
||||||
|
{
|
||||||
spawn_work(
|
spawn_work(
|
||||||
&cgcx,
|
&cgcx,
|
||||||
&mut llvm_start_time,
|
&mut llvm_start_time,
|
||||||
|
|
|
@ -655,25 +655,20 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
||||||
// llvm/llvm-project#70563).
|
// llvm/llvm-project#70563).
|
||||||
if !codegen_fn_attrs.target_features.is_empty()
|
if !codegen_fn_attrs.target_features.is_empty()
|
||||||
&& matches!(codegen_fn_attrs.inline, InlineAttr::Always)
|
&& matches!(codegen_fn_attrs.inline, InlineAttr::Always)
|
||||||
|
&& let Some(span) = inline_span
|
||||||
{
|
{
|
||||||
if let Some(span) = inline_span {
|
tcx.dcx().span_err(span, "cannot use `#[inline(always)]` with `#[target_feature]`");
|
||||||
tcx.dcx().span_err(span, "cannot use `#[inline(always)]` with `#[target_feature]`");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !codegen_fn_attrs.no_sanitize.is_empty() && codegen_fn_attrs.inline.always() {
|
if !codegen_fn_attrs.no_sanitize.is_empty()
|
||||||
if let (Some(no_sanitize_span), Some(inline_span)) = (no_sanitize_span, inline_span) {
|
&& codegen_fn_attrs.inline.always()
|
||||||
let hir_id = tcx.local_def_id_to_hir_id(did);
|
&& let (Some(no_sanitize_span), Some(inline_span)) = (no_sanitize_span, inline_span)
|
||||||
tcx.node_span_lint(
|
{
|
||||||
lint::builtin::INLINE_NO_SANITIZE,
|
let hir_id = tcx.local_def_id_to_hir_id(did);
|
||||||
hir_id,
|
tcx.node_span_lint(lint::builtin::INLINE_NO_SANITIZE, hir_id, no_sanitize_span, |lint| {
|
||||||
no_sanitize_span,
|
lint.primary_message("`no_sanitize` will have no effect after inlining");
|
||||||
|lint| {
|
lint.span_note(inline_span, "inlining requested here");
|
||||||
lint.primary_message("`no_sanitize` will have no effect after inlining");
|
})
|
||||||
lint.span_note(inline_span, "inlining requested here");
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Weak lang items have the same semantics as "std internal" symbols in the
|
// Weak lang items have the same semantics as "std internal" symbols in the
|
||||||
|
@ -703,10 +698,10 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
||||||
// Any linkage to LLVM intrinsics for now forcibly marks them all as never
|
// Any linkage to LLVM intrinsics for now forcibly marks them all as never
|
||||||
// unwinds since LLVM sometimes can't handle codegen which `invoke`s
|
// unwinds since LLVM sometimes can't handle codegen which `invoke`s
|
||||||
// intrinsic functions.
|
// intrinsic functions.
|
||||||
if let Some(name) = &codegen_fn_attrs.link_name {
|
if let Some(name) = &codegen_fn_attrs.link_name
|
||||||
if name.as_str().starts_with("llvm.") {
|
&& name.as_str().starts_with("llvm.")
|
||||||
codegen_fn_attrs.flags |= CodegenFnAttrFlags::NEVER_UNWIND;
|
{
|
||||||
}
|
codegen_fn_attrs.flags |= CodegenFnAttrFlags::NEVER_UNWIND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(features) = check_tied_features(
|
if let Some(features) = check_tied_features(
|
||||||
|
|
|
@ -990,8 +990,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Split the rust-call tupled arguments off.
|
// Split the rust-call tupled arguments off.
|
||||||
let (first_args, untuple) = if abi == ExternAbi::RustCall && !args.is_empty() {
|
let (first_args, untuple) = if abi == ExternAbi::RustCall
|
||||||
let (tup, args) = args.split_last().unwrap();
|
&& let Some((tup, args)) = args.split_last()
|
||||||
|
{
|
||||||
(args, Some(tup))
|
(args, Some(tup))
|
||||||
} else {
|
} else {
|
||||||
(args, None)
|
(args, None)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue