rust-lang / rust-lang/rust

`-Zprint-llvm-passes` lies on recent rustc

Open
#124,005 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-LLVM C-bug T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

-Zprint-llvm-passes, best I can tell, is equivalent to clang -cc1 -mdebug-pass=Structure, which is the wrong way to print out the pass order in the new PM. I found a relevant LLVM bug: https://github.com/llvm/llvm-project/issues/28692.

The best way to actually get which passes ran is -Ztime-llvm-passes, which unfortunately does not provide a pass order.

I don't know how rustc actually actuates LLVM, but it may be worthwhile to figure out a way to get a handle on the PM and print the pass order directly. Ideally, LLVM should have a "what passes and analyses did you actually run" setting, but that will require actually bodging that into the new PM (which the aforementioned issue suggests doing).

I also kind of hate -mdebug-pass=Structure, since it doesn't use the either the opt names or the LLVM type names for the passes, which makes it hard to actually figure out what passes the pass order actually refers to.

cc @workingjubilee

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the discrepancy between rustc's -Zprint-llvm-passes and -Ztime-llvm-passes, then read the linked LLVM issue about reporting new pass-manager activity. Done means rustc can expose the actual LLVM pass order with recognizable pass names rather than the misleading structure output.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.