Stream: t-compiler

Topic: fine-grained optimization attributes

pnkfelix (Feb 21 2019 at 11:35, on Zulip):

Hey @nagisa , while looking over #53823, I had the following potentially very-terrible idea: Have we considered generalizing RFC 2412 ("The optimize attribute"), implemented by PR #55641, to allow one to even toggle individual llvm-args? (In the case of #53823, the motivation would be to toggle llvm-args=-x86-cmov-converter=false just on the fn binary_search methods.)

centril (Feb 21 2019 at 13:17, on Zulip):

Seems problematic to acknowledge the existence of LLVM in the language itself...

centril (Feb 21 2019 at 13:17, on Zulip):

if you can phrase it in backend-neutral terms that might be more workable

centril (Feb 21 2019 at 13:18, on Zulip):

for the standard library such fine-grained optimizations could be done with #[rustc_optimize(...)] as a forever-unstable mechanism

rkruppe (Feb 21 2019 at 16:11, on Zulip):

LLVM command line arguments unfortunately can't be toggled on such a fine grained level. For a few things there might be corresponding function attributes we could use, but usually it's just global state. To change it for one function, you'd need to break out that function into a separate compilation unit and run the relevant parts of the pipeline (which for cmov conversion includes the codegen pipeline) and stitch the results together (in this case, that means linking machine code).

nagisa (Feb 21 2019 at 16:34, on Zulip):

we haven’t.

Last update: Jul 14 2020 at 11:55UTC