check_inline_always_target_features

Function check_inline_always_target_features 

Source
fn check_inline_always_target_features<'tcx>(
    tcx: TyCtxt<'tcx>,
    body: &Body<'tcx>,
)
Expand description

#[target_feature]-annotated functions can be marked #[inline] and will only be inlined if the target features match (as well as all of the other inlining heuristics). #[inline(always)] will always inline regardless of matching target features, which can result in errors from LLVM. However, it is desirable to be able to always annotate certain functions (e.g. SIMD intrinsics) as #[inline(always)] but check the target features match in Rust to avoid the LLVM errors.

We check the caller and callee target features to ensure that this can be done or emit a lint.