Closed
Description
In vectordotdev/vector#15631 (comment) I tried to optimize Vector with LTO + PGO enabled. But during the optimization phase (done with cargo pgo optimize
) I get the following error: Kobzol/cargo-pgo#32 (comment) . I am not the only person with this error - llvm/llvm-project#57501 (comment) (@kevincox probably can provide more details about they project).
The only way to avoid the bug is disable LTO completely (switching from Fat to Thin mode does not help).
I expected to see this happen: Vector compiles successfully with LTO and PGO enabled.
Instead, this happened: Vector failed to compile with LTO + PGO.
Meta
rustc --version --verbose
(from https://github.com/vectordotdev/vector/blob/master/rust-toolchain.toml):
1.71.1
Other links:
- Possibly related bug in LLVM (but I am not sure): [15 regression] "module flag identifiers must be unique (or of 'require' type) llvm/llvm-project#57501
- A discussion in
cargo-pgo
: LLVM ERROR: Broken module found, compilation aborted Kobzol/cargo-pgo#32
Activity
Kobzol commentedon Aug 29, 2023
Were you able to reproduce this without using cargo pgo, by using the compiler flags manually? (-Cprofile-generate etc.)
zamazan4ik commentedon Aug 29, 2023
I haven't tried to do it yet but I will (and then report the results here)
kevincox commentedon Aug 29, 2023
My project was done using the flags directly. See https://gitlab.com/kevincox/ricochetrobots/-/blob/6bbc44ddbf2ab8ae9edcbdca62e3035572f9c1ed/default.nix#L41-57
caizixian commentedon Sep 1, 2023
I'm using the compiler flag directly (via
RUSTFLAGS
).RUSTFLAGS="-Cprofile-use=/tmp/pgo-data/merged.profdata -Cllvm-args=-pgo-warn-missing-function"
fails withThe file is confirmed to exist via
ls
. Themerged.profdata
is generated usingllvm-profdata
shipped with Rust 1.71.1.RUSTFLAGS="-Clto=false -Cprofile-use=/tmp/pgo-data/merged.profdata -Cllvm-args=-pgo-warn-missing-function"
works.My PGO+LTO setup worked with Rust 1.66.1, but doesn't work with 1.71.1.
lqd commentedon Sep 1, 2023
This "file does not exist" error seems like a different one from the OP ("LLVM ERROR: Broken module found, compilation aborted!"), and it would be good to have a small self-contained example for your new error -- and possibly a dedicated issue since it also looks different from #63609. It feels possible to investigate in
mmtk-openjdk
directly, but to land a fix with a non-regression test, a small reproducer (MCVE) is going to be important.zamazan4ik commentedon Sep 1, 2023
I got the same issue during the ruff optimization with PGO with
cargo-pgo
. When I runcargo pgo optimize bench
in https://github.com/astral-sh/ruff/tree/main/crates/ruff_benchmark on my Mac machine (Macbook M1 Pro, macOS 13.4 Ventura), I get the following error:Note that Ruff also enables LTO as a part of its Release profile. When I switch off LTO,
cargo pgo optimize bench
builds Ruff successfully.Additional details -
cargo pgo info
:Tested the same scenario on my Linux machine (Fedora 38, x86-64) for the same scenario with the same Rust version and got the same error.
61 remaining items