1
Fork 0
rust/compiler/rustc_codegen_llvm/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 Auto merge of #112591 - jfgoog:better-dlltool-diagnostics, r=WaffleLapkin 2023-07-19 07:27:50 +00:00
coverageinfo Auto merge of #113430 - Zalathar:hash, r=b-naber 2023-07-16 01:56:23 +00:00
debuginfo refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
llvm Remove LLVMRustCoverageHashCString 2023-07-13 11:31:15 +10:00
abi.rs Move TyCtxt::mk_x to Ty::new_x where applicable 2023-07-05 20:27:07 +01:00
allocator.rs Revert "use new c literals instead of cstr! macro" 2023-07-05 13:11:27 +02:00
asm.rs Rollup merge of #111332 - loongarch-rs:inline-asm, r=Amanieu 2023-05-08 19:41:51 +09:00
attributes.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
base.rs Introduce MonoItemData. 2023-07-17 08:44:48 +10:00
builder.rs Revert "use new c literals instead of cstr! macro" 2023-07-05 13:11:27 +02:00
callee.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
common.rs Reuse LLVMConstInBoundsGEP2 2023-07-10 00:20:56 -07:00
consts.rs Revert "use new c literals instead of cstr! macro" 2023-07-05 13:11:27 +02:00
context.rs Revert "use new c literals instead of cstr! macro" 2023-07-05 13:11:27 +02:00
declare.rs CFI: Fix SIGILL reached via trait objects 2023-05-09 20:04:19 +00:00
errors.rs Better diagnostics for dlltool errors. 2023-07-17 20:20:01 +00:00
intrinsic.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
lib.rs Revert "use new c literals instead of cstr! macro" 2023-07-05 13:11:27 +02:00
llvm_util.rs Create a structure to define the features from to_llvm_features. 2023-05-22 14:46:40 +01:00
mono_item.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
type_.rs add wasm eh intrinsics 2023-06-07 17:46:34 +02:00
type_of.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
va_arg.rs Move TyCtxt::mk_x to Ty::new_x where applicable 2023-07-05 20:27:07 +01:00
value.rs