rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.83k stars 12.66k forks source link

"Stability" of the `-C passes` and `-C llvm-args` flags #40063

Open japaric opened 7 years ago

japaric commented 7 years ago

These flags are part of the stable rustc CLI but they let you tap into LLVM internals that we can't guarantee the stability of. Known usages of these flags include:

Concerns:

We discussed this a bit towards the end of the last tools meeting. Some ways to communicate the unstability of these flags were brought up:

cc @rust-lang/tools

nagisa commented 7 years ago

These are all LLVM specific or closely tied to LLVM:

    -C                   lto -- perform LLVM link-time optimizations
    -C        target-cpu=val -- select target processor (rustc --print target-cpus for details)
    -C    target-feature=val -- target specific attributes (rustc --print target-features for details)
    -C            passes=val -- a list of extra LLVM passes to run (space separated)
    -C         llvm-args=val -- a list of arguments to pass to llvm (space separated)
    -C            save-temps -- save all temporary output files during compilation
    -C no-prepopulate-passes -- don't pre-populate the pass manager with a list of passes
    -C    no-vectorize-loops -- don't run the loop vectorization optimization passes
    -C      no-vectorize-slp -- don't run LLVM's SLP vectorization pass
    -C      no-integrated-as -- use an external assembler rather than LLVM's integrated one
    -C        no-redzone=val -- disable the use of the redzone
    -C  relocation-model=val -- choose the relocation model to use (rustc --print relocation-models for details)
    -C        code-model=val -- choose the code model to use (rustc --print code-models for details)
    -C            remark=val -- print remarks for these optimization passes (space separated, or "all")
    -C  inline-threshold=val -- set the inlining threshold for

The fact that these are codegen flags should be indicative of some of these being LLVM-specific and making these stable-ish was a decision made early on, back when multiple backends wasn’t even in the books.

cargo-fuzz project itself does not consider these to be stable in any way, but it is certainly possible to make cargo-fuzz run on stable (without -Z flags) as things are now, even though it is very LLVM-specific.

alexcrichton commented 7 years ago

My personal preference here is the last one mentioned, adding specific options for these various intents (e.g. -Z fuzz and -Z code-coverage).

cc @Manishearth for cargo-fuzz

@nagisa is right though that it's not just limited to these, this is indeed a pervasive problem with -C right now.

Manishearth commented 7 years ago

Yeah, I'm open to that. cargo-fuzz does directly pass some llvm-args down though.