diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2023-07-19 22:37:06 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-19 22:37:06 +0530 |
| commit | c1d6d322f424335c4bafaeb2e175561b353a185a (patch) | |
| tree | 4750fbdbeb1cb41671144f3205adef74a7dc041d /compiler/rustc_codegen_gcc | |
| parent | c2257b94129ff39129f8f684244eaa961b720799 (diff) | |
| parent | cc08749df2613c17c8c2e9d8224a24a24c126423 (diff) | |
| download | rust-c1d6d322f424335c4bafaeb2e175561b353a185a.tar.gz rust-c1d6d322f424335c4bafaeb2e175561b353a185a.zip | |
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?
Diffstat (limited to 'compiler/rustc_codegen_gcc')
0 files changed, 0 insertions, 0 deletions
