Attribute to control frame pointers #872
Labels
major-change
A proposal to make a major change to rustc
T-compiler
Add this label so rfcbot knows to poll the compiler team
Background
The standard library is distributed with
-Cforce-frame-pointers=true
, which was added in rust-lang/rust#122646 to aid profiling. This is a net positive but there are some cases where having frame pointers doesn't make as much sense.compiler_builtins
has a handful of small functions that can't be inlined because they must be a callable symbol, but are tiny enough that updating the frame pointer contributes to a significant portion of the instruction count.The most notable example is our current
fma
implementation with runtime feature detection on x86. This would usually be three instructions, but tracking the frame pointer triples this count (involves two noninlineable symbols).More background: https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/significant.20mul_add.20perf.20regression.20since.20nightly-2025-03-06/with/516632450
Proposal
LLVM's
frame-pointer
attribute is function-level, so we can add an unstable attribute to match them.These will override the
-Cforce-frame-pointers
setting for that crate.LLVM docs: https://llvm.org/docs/LangRef.html#function-attributes.
Mentors or Reviewers
If you have a reviewer or mentor in mind for this work, mention them
here. You can put your own name here if you are planning to mentor the
work.
Process
The main points of the Major Change Process are as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
The text was updated successfully, but these errors were encountered: