about summary refs log tree commit diff
path: root/src/test/rustdoc/codeblock-title.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-06-17 11:30:56 +0000
committerbors <bors@rust-lang.org>2020-06-17 11:30:56 +0000
commit2935d294ff862fdf96578d0cbbdc289e8e7ba81c (patch)
tree207812bb763529b6eb1502f91cde747a170034ae /src/test/rustdoc/codeblock-title.rs
parente8ff4bcbd02475cf487cd101bf32954dc63366d4 (diff)
parent3da3d15f9f150dafd7d635859795c4c714e7b7ad (diff)
downloadrust-2935d294ff862fdf96578d0cbbdc289e8e7ba81c.tar.gz
rust-2935d294ff862fdf96578d0cbbdc289e8e7ba81c.zip
Auto merge of #69890 - lenary:lenary/riscv-frame-pointers, r=hanna-kruppe,Mark-Simulacrum
[RISC-V] Do not force frame pointers

We have been seeing some very inefficient code that went away when using
`-Cforce-frame-pointers=no`. For instance `core::ptr::drop_in_place` at
`-Oz` was compiled into a function which consisted entirely of saving
registers to the stack, then using the frame pointer to restore the same
registers (without any instructions between the prolog and epilog).

The RISC-V LLVM backend supports frame pointer elimination, so it makes
sense to allow this to happen when using Rust. It's not clear to me that
frame pointers have ever been required in the general case.

In rust-lang/rust#61675 it was pointed out that this made reassembling
stack traces easier, which is true, but there is a code generation
option for forcing frame pointers, and I feel the default should not be
to require frame pointers, given it demonstrably makes code size worse
(around 10% in some embedded applications).

The kinds of targets mentioned in rust-lang/rust#61675 are popular, but
should not dictate that code generation should be worse for all RISC-V
targets, especially as there is a way to use CFI information to
reconstruct the stack when the frame pointer is eliminated. It is also
a misconception that `fp` is always used for the frame pointer. `fp` is
an ABI name for `x8` (aka `s0`), and if no frame pointer is required,
`x8` may be used for other callee-saved values.

---

I am partly posting this to get feedback from @fintelia who introduced the change to require frame pointers, and @hanna-kruppe who had issues with the original PR. I would understand if we wanted to remove this setting on only a subset of RISC-V targets, but my preference would be to remove this setting everywhere.

There are more details on the code size savings seen in Tock here: https://github.com/tock/tock/pull/1660
Diffstat (limited to 'src/test/rustdoc/codeblock-title.rs')
0 files changed, 0 insertions, 0 deletions