Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always inline functions signatures containing f16 or f128 #133050

Merged
merged 2 commits into from
Nov 15, 2024

Commits on Nov 14, 2024

  1. Pass f16 and f128 by value in const_assert!

    These types are currently passed by reference, which does not avoid the
    backend crashes. Change these back to being passed by value, which makes
    the types easier to detect for automatic inlining.
    tgross35 committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    b77dbbd View commit details
    Browse the repository at this point in the history
  2. Always inline functions signatures containing f16 or f128

    There are a handful of tier 2 and tier 3 targets that cause a LLVM crash
    or linker error when generating code that contains `f16` or `f128`. The
    cranelift backend also does not support these types. To work around
    this, every function in `std` or `core` that contains these types must
    be marked `#[inline]` in order to avoid sending any code to the backend
    unless specifically requested.
    
    However, this is inconvenient and easy to forget. Introduce a check for
    these types in the frontend that automatically inlines any function
    signatures that take or return `f16` or `f128`.
    
    Note that this is not a perfect fix because it does not account for the
    types being passed by reference or as members of aggregate types, but
    this is sufficient for what is currently needed in the standard library.
    
    Fixes: rust-lang#133035
    Closes: rust-lang#133037
    tgross35 committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    5d81891 View commit details
    Browse the repository at this point in the history