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.)
Seems problematic to acknowledge the existence of LLVM in the language itself...
if you can phrase it in backend-neutral terms that might be more workable
for the standard library such fine-grained optimizations could be done with
#[rustc_optimize(...)] as a forever-unstable mechanism
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).