rust/compiler/rustc_codegen_ssa/src
Dylan DPC c1d6d322f4
Rollup merge of #113716 - DianQK:add-no_builtins-to-function, r=pnkfelix
Add the `no-builtins` attribute to functions when `no_builtins` is applied at the crate level.

**When `no_builtins` is applied at the crate level, we should add the `no-builtins` attribute to each function to ensure it takes effect in LTO.**

This is also the reason why no_builtins does not take effect in LTO as mentioned in #35540.

Now, `#![no_builtins]` should be similar to `-fno-builtin` in clang/gcc, see https://clang.godbolt.org/z/z4j6Wsod5.

Next, we should make `#![no_builtins]` participate in LTO again. That makes sense, as LTO also takes into consideration function-level instruction optimizations, such as the MachineOutliner. More importantly, when a user writes a large `#![no_builtins]` crate, they would like this crate to participate in LTO as well.

We should also add a function-level no_builtins attribute to allow users to have more control over it. This is similar to Clang's `__attribute__((no_builtin))` feature, see https://clang.godbolt.org/z/Wod6KK6eq. Before implementing this feature, maybe we should discuss whether to support more fine-grained control, such as `__attribute__((no_builtin("memcpy")))`.

Related discussions:
- #109821
- #35540

Next (a separate pull request?):
- [ ] Revert #35637
- [ ] Add a function-level `no_builtin` attribute?
2023-07-19 22:37:06 +05:30
..
back support for mips32r6 as a target_arch value 2023-07-18 18:58:18 +08:00
debuginfo refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
mir Auto merge of #112157 - erikdesjardins:align, r=nikic 2023-07-15 15:39:53 +00:00
traits Remove trait CoverageInfoMethods, since non-LLVM backends don't need it 2023-07-05 20:40:40 +10:00
base.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
codegen_attrs.rs Add the no-builtins attribute to functions when no_builtins is applied at the crate level. 2023-07-18 22:15:47 +08:00
common.rs Promote unchecked_add/sub/mul/shl/shr to mir::BinOp 2023-06-19 01:47:03 -07:00
errors.rs Add rustc option to output LLVM optimization remarks to YAML files 2023-07-02 13:41:36 +02:00
glue.rs Use size_of_val instead of manual calculation 2023-03-17 19:55:49 -07:00
lib.rs Move coverageinfo::ffi and coverageinfo::map out of SSA 2023-07-05 20:40:40 +10:00
meth.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
mono_item.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
target_features.rs support for mips32r6 as a target_arch value 2023-07-18 18:58:18 +08:00