rust/compiler
bors c38b8a8c62 Auto merge of #94579 - tmiasko:target-features, r=nagisa
Always include global target features in function attributes

This ensures that information about target features configured with
`-C target-feature=...` or detected with `-C target-cpu=native` is
retained for subsequent consumers of LLVM bitcode.

This is crucial for linker plugin LTO, since this information is not
conveyed to the plugin otherwise.

<details><summary>Additional test case demonstrating the issue</summary>

```rust
extern crate core;

#[inline]
#[target_feature(enable = "aes")]
unsafe fn f(a: u128, b: u128) -> u128 {
    use core::arch::x86_64::*;
    use core::mem::transmute;
    transmute(_mm_aesenc_si128(transmute(a), transmute(b)))
}

pub fn g(a: u128, b: u128) -> u128 {
    unsafe { f(a, b) }
}

fn main() {
    let mut args = std::env::args();
    let _ = args.next().unwrap();
    let a: u128 = args.next().unwrap().parse().unwrap();
    let b: u128 = args.next().unwrap().parse().unwrap();
    println!("{}", g(a, b));
}
```

```console
$ rustc --edition=2021 a.rs -Clinker-plugin-lto -Clink-arg=-fuse-ld=lld  -Ctarget-feature=+aes -O
...
  = note: LLVM ERROR: Cannot select: intrinsic %llvm.x86.aesni.aesenc
```

</details>

r? `@nagisa`
2022-03-06 18:07:11 +00:00
..
2022-03-05 21:20:12 -05:00
2022-03-04 11:54:28 -06:00
2022-03-03 19:47:23 +08:00
2022-03-04 11:54:28 -06:00
2022-03-01 20:02:47 +08:00
2022-03-03 19:47:23 +08:00
2022-02-24 16:02:07 -05:00
2022-02-24 17:01:01 +11:00
2022-03-05 13:15:00 -05:00
2022-03-05 13:15:00 -05:00
2022-03-05 15:31:22 +01:00
2022-03-04 11:54:28 -06:00
2022-02-25 08:00:52 -05:00
2022-02-25 08:00:52 -05:00