-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LLVM error: "Instruction does not dominate all uses!" on Windows #72470
Comments
A smaller reproduction would be useful (if that's possible), marking needs-mcve |
@rustbot ping cleanup |
Hey Cleanup Crew ICE-breakers! This bug has been identified as a good cc @AminArria @chrissimpkins @contrun @DutchGhost @elshize @ethanboxx @h-michael @HallerPatrick @hdhoang @hellow554 @imtsuki @jakevossen5 @kanru @KarlK90 @LeSeulArtichaut @MAdrianMattocks @matheus-consoli @mental32 @nmccarty @Noah-Kennedy @pard68 @PeytonT @pierreN @Redblueflame @RobbieClarken @RobertoSnap @robjtede @SarthakSingh31 @senden9 @shekohex @sinato @spastorino @turboladen @woshilapin @yerke |
With some bisection, I think this caused by #71840, cc @matthewjasper |
Assigning @rustbot ping llvm |
Hey LLVM ICE-breakers! This bug has been identified as a good cc @comex @CrazyDebugger @cuviper @DutchGhost @hanna-kruppe @hdhoang @heyrutvik @JOE1994 @jryans @mmilenko @nagisa @nikic @Noah-Kennedy @SiavoshZarrasvand @spastorino @vertexclique |
self-assigning, with plan to revert injecting PR before it hits beta. |
So, investigating this bug some more:
So reverting is the only thing that I can think of to fix this. |
Is the only quick fix, I guess. Ultimately this extremely likely to be an issue in LLVM itself – you cannot really construct a IR malformed in a way that would raise this error in lowering to LLVM-IR (I believe almost by construction of the LLVM API), especially because we do not generate phis. I think the PR in question is worthwhile enough to warrant spending time looking into it, so I would love to see an issue filled with links to all the information we currently have so that it does not get lost as this one is closed by the PR above. |
Thanks @xtutu ! I was able to replicate the LLVM assertion now with that Cargo.lock in place! (And of course, I had to remember to do |
I've narrowed the // src/main.rs
use tokio;
use std::error::Error;
use std::sync::Mutex;
#[allow(dead_code)]
enum Msg {
A(Vec<()>),
B,
}
#[allow(unused_must_use)]
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let (_, mut rx) = tokio::sync::mpsc::unbounded_channel::<Msg>();
let entity = Box::new(Mutex::new(()));
tokio::spawn(async move {
tokio::select! {
Some(msg) = rx.recv() => {
entity.lock();
drop(msg);
}
}
entity.lock();
});
return Ok(());
} # Cargo.toml
[package]
name = "rust-template"
version = "0.1.0"
authors = ["linyongxing <xtutu0202@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
default-run = "rust-template"
[dependencies]
tokio = { version = "=0.2.21", features = ["rt-core", "macros", "sync"] } With these two files in a fresh crate, I get this from a release build (still on Windows, keep in mind, with stable rustc 1.44.1 c7087fe): > cargo build --release
Updating crates.io index
Compiling proc-macro2 v1.0.19
Compiling unicode-xid v0.2.1
Compiling syn v1.0.36
Compiling bytes v0.5.6
Compiling fnv v1.0.7
Compiling pin-project-lite v0.1.7
Compiling quote v1.0.7
Compiling tokio-macros v0.2.5
Compiling tokio v0.2.21
Compiling rust-template v0.1.0 (C:\Users\pfxbo\temp-rust-debug\rust-template)
Instruction does not dominate all uses!
%182 = phi i8* [ %92, %91 ], [ %55, %190 ], [ %182, %89 ], [ %182, %85 ], [ %182, %187 ], [ %182, %112 ], [ %182, %108 ], [ %182, %105 ], [ %182, %101 ]
%182 = phi i8* [ %92, %91 ], [ %55, %190 ], [ %182, %89 ], [ %182, %85 ], [ %182, %187 ], [ %182, %112 ], [ %182, %108 ], [ %182, %105 ], [ %182, %101 ]
Instruction does not dominate all uses!
%182 = phi i8* [ %92, %91 ], [ %55, %190 ], [ %182, %89 ], [ %182, %85 ], [ %182, %187 ], [ %182, %112 ], [ %182, %108 ], [ %182, %105 ], [ %182, %101 ]
%182 = phi i8* [ %92, %91 ], [ %55, %190 ], [ %182, %89 ], [ %182, %85 ], [ %182, %187 ], [ %182, %112 ], [ %182, %108 ], [ %182, %105 ], [ %182, %101 ]
Instruction does not dominate all uses!
%182 = phi i8* [ %92, %91 ], [ %55, %190 ], [ %182, %89 ], [ %182, %85 ], [ %182, %187 ], [ %182, %112 ], [ %182, %108 ], [ %182, %105 ], [ %182, %101 ]
%182 = phi i8* [ %92, %91 ], [ %55, %190 ], [ %182, %89 ], [ %182, %85 ], [ %182, %187 ], [ %182, %112 ], [ %182, %108 ], [ %182, %105 ], [ %182, %101 ]
Instruction does not dominate all uses!
%182 = phi i8* [ %92, %91 ], [ %55, %190 ], [ %182, %89 ], [ %182, %85 ], [ %182, %187 ], [ %182, %112 ], [ %182, %108 ], [ %182, %105 ], [ %182, %101 ]
%182 = phi i8* [ %92, %91 ], [ %55, %190 ], [ %182, %89 ], [ %182, %85 ], [ %182, %187 ], [ %182, %112 ], [ %182, %108 ], [ %182, %105 ], [ %182, %101 ]
Instruction does not dominate all uses!
%182 = phi i8* [ %92, %91 ], [ %55, %190 ], [ %182, %89 ], [ %182, %85 ], [ %182, %187 ], [ %182, %112 ], [ %182, %108 ], [ %182, %105 ], [ %182, %101 ]
%182 = phi i8* [ %92, %91 ], [ %55, %190 ], [ %182, %89 ], [ %182, %85 ], [ %182, %187 ], [ %182, %112 ], [ %182, %108 ], [ %182, %105 ], [ %182, %101 ]
Instruction does not dominate all uses!
%182 = phi i8* [ %92, %91 ], [ %55, %190 ], [ %182, %89 ], [ %182, %85 ], [ %182, %187 ], [ %182, %112 ], [ %182, %108 ], [ %182, %105 ], [ %182, %101 ]
%182 = phi i8* [ %92, %91 ], [ %55, %190 ], [ %182, %89 ], [ %182, %85 ], [ %182, %187 ], [ %182, %112 ], [ %182, %108 ], [ %182, %105 ], [ %182, %101 ]
Instruction does not dominate all uses!
%182 = phi i8* [ %92, %91 ], [ %55, %190 ], [ %182, %89 ], [ %182, %85 ], [ %182, %187 ], [ %182, %112 ], [ %182, %108 ], [ %182, %105 ], [ %182, %101 ]
%182 = phi i8* [ %92, %91 ], [ %55, %190 ], [ %182, %89 ], [ %182, %85 ], [ %182, %187 ], [ %182, %112 ], [ %182, %108 ], [ %182, %105 ], [ %182, %101 ]
in function _ZN97_$LT$core..future..from_generator..GenFuture$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$4poll17h257417a290b49d85E
LLVM ERROR: Broken function found, compilation aborted!
error: could not compile `rust-template`.
To learn more, run the command again with --verbose. |
We've been running into this error using Windows MSVC on our work codebase. I've been able to pin down the regression to the Rust 1.44.0 which was part of #69033. We've not observed this error occurring on Linux, MacOS, FreeBSD, or Windows-GNU. cc/ @jonas-schievink ErrorInstruction does not dominate all uses!
%13219 = phi i8* [ %13219, %13235 ], [ %13219, %13233 ], [ %13219, %13230 ], [ %13219, %13227 ], [ %13219, %13224 ], [ %13219, %13221 ], [ %13219, %12592 ], [ %13219, %12707 ], [ %12837, %12834 ], [ %12831, %12827 ], [ %13219, %12944 ]
%13219 = phi i8* [ %13219, %13235 ], [ %13219, %13233 ], [ %13219, %13230 ], [ %13219, %13227 ], [ %13219, %13224 ], [ %13219, %13221 ], [ %13219, %12592 ], [ %13219, %12707 ], [ %12837, %12834 ], [ %12831, %12827 ], [ %13219, %12944 ]
Instruction does not dominate all uses!
%13219 = phi i8* [ %13219, %13235 ], [ %13219, %13233 ], [ %13219, %13230 ], [ %13219, %13227 ], [ %13219, %13224 ], [ %13219, %13221 ], [ %13219, %12592 ], [ %13219, %12707 ], [ %12837, %12834 ], [ %12831, %12827 ], [ %13219, %12944 ]
%13219 = phi i8* [ %13219, %13235 ], [ %13219, %13233 ], [ %13219, %13230 ], [ %13219, %13227 ], [ %13219, %13224 ], [ %13219, %13221 ], [ %13219, %12592 ], [ %13219, %12707 ], [ %12837, %12834 ], [ %12831, %12827 ], [ %13219, %12944 ]
Instruction does not dominate all uses!
%13219 = phi i8* [ %13219, %13235 ], [ %13219, %13233 ], [ %13219, %13230 ], [ %13219, %13227 ], [ %13219, %13224 ], [ %13219, %13221 ], [ %13219, %12592 ], [ %13219, %12707 ], [ %12837, %12834 ], [ %12831, %12827 ], [ %13219, %12944 ]
%13219 = phi i8* [ %13219, %13235 ], [ %13219, %13233 ], [ %13219, %13230 ], [ %13219, %13227 ], [ %13219, %13224 ], [ %13219, %13221 ], [ %13219, %12592 ], [ %13219, %12707 ], [ %12837, %12834 ], [ %12831, %12827 ], [ %13219, %12944 ]
Instruction does not dominate all uses!
%13219 = phi i8* [ %13219, %13235 ], [ %13219, %13233 ], [ %13219, %13230 ], [ %13219, %13227 ], [ %13219, %13224 ], [ %13219, %13221 ], [ %13219, %12592 ], [ %13219, %12707 ], [ %12837, %12834 ], [ %12831, %12827 ], [ %13219, %12944 ]
%13219 = phi i8* [ %13219, %13235 ], [ %13219, %13233 ], [ %13219, %13230 ], [ %13219, %13227 ], [ %13219, %13224 ], [ %13219, %13221 ], [ %13219, %12592 ], [ %13219, %12707 ], [ %12837, %12834 ], [ %12831, %12827 ], [ %13219, %12944 ]
Instruction does not dominate all uses!
%13219 = phi i8* [ %13219, %13235 ], [ %13219, %13233 ], [ %13219, %13230 ], [ %13219, %13227 ], [ %13219, %13224 ], [ %13219, %13221 ], [ %13219, %12592 ], [ %13219, %12707 ], [ %12837, %12834 ], [ %12831, %12827 ], [ %13219, %12944 ]
%13219 = phi i8* [ %13219, %13235 ], [ %13219, %13233 ], [ %13219, %13230 ], [ %13219, %13227 ], [ %132197 ], [ %13219, %12944 ]
Instruction does not dominate all uses!
%13219 = phi i8* [ %13219, %13235 ], [ %13219, %13233 ], [ %13219, %13230 ], [ %13219, %13227 ], [ %13219, %13224 ], [ %13219, %13221 ], [ %13219, %12592 ], [ %13219, %12707 ], [ %12837, %12834 ], [ %12831, %12827 ], [ %13219, %12944 ]
%13219 = phi i8* [ %13219, %13235 ], [ %13219, %13233 ], [ %13219, %13230 ], [ %13219, %13227 ], [ %13219, %13224 ], [ %13219, %13221 ], [ %13219, %12592 ], [ %13219, %12707 ], [ %12837, %12834 ], [ %12831, %12827 ], [ %13219, %12944 ]
in function _ZN8tiberius3tds6stream5token20TokenStream$LT$S$GT$10try_unfold28_$u7b$$u7b$closure$u7d$$u7d$28_$u7b$$u7b$closure$u7d$$u7d$17hbf00841fdd51402aE.llvm.12308354007712700541
LLVM ERROR: Broken function found, compilation aborted!
error: could not compile `quaint`. After this error the usual error of Tested versionsI've tested a range of versions on several Windows machines. I reliably got the following results:
ReproThe main codebase at work is a rather large one and takes a while to compile. I haven't been able to pin this down to a specific dependency or file that triggers this error yet. Luckily our codebase is open source, which allows people to clone and build it. To do so do: $ git clone git@github.com:prisma/prisma-engines.git
$ cd prisma-engines
$ cargo build --release I don't believe we have any peer dependencies aside from a Rust MSVC toolchain to compile on Windows. |
prisma-engines has multiple C dependencies (libsqlite, zlib, libgit2), which means that cross-compiling it rather painful (from Linux to Windows, that is). I did further reduce the code posted by @pnkfelix above though, removing tokio's proc. macros in the process: https://github.com/jonas-schievink/llvm-error I'll try to reduce that down further. |
I have now pushed a 2-file repro. I'll leave the rest to our LLVM experts. |
I've filed two test cases on the repro:
It seems that switching the channel impl makes the error disappear. Whereas switching the block_on impl keeps it. According to @jonas-schievink in https://github.com/jonas-schievink/llvm-error/pull/1#issuecomment-668535630 the channel code is quite fragile, and changing any part of it makes the error disappear. |
Does this still reproduce with the latest nightly (LLVM 11)? |
On |
A bisect shows that this was fixed by the upgrade to LLVM 11 in #73526. I'm going to try-relanding the original PR. |
This was fixed with the upgrade to LLVM 11 in rust-lang#73526. It seems extremely unlikey that this exact issue will ever reoccur, since slight modifications to the code caused the crash to stop happening. However, it can't hurt to have a test for it.
…jasper Re-land PR rust-lang#71840 (Rework MIR drop tree lowering) PR rust-lang#71840 was reverted in rust-lang#72989 to fix an LLVM error (rust-lang#72470). That LLVM error no longer occurs with the recent upgrade to LLVM 11 (rust-lang#73526), so let's try re-landing this PR. I've cherry-picked the commits from the original PR (with the exception of the commit blessing test output), making as few modifications as possible. I addressed the rebase fallout in separate commits on top of those. r? `@matthewjasper`
Fixed by #77466. |
The hope is that the random LLVM failures will stop, rust-lang/rust#72470 being fixed.
* remove apply migration * remove listmigrations * remove calculatedatabasesteps * remove calculateDatamodel * remove inferMigrationSteps * remove migrationProgress * remove unapplyMigrations * remove initialize * start removing old migration persistence * start removing migrationsteps serialization * remove steps serialization * remove partialeq * Ignore postgis tables when checking for initialized schemas * Fix sqlite test * Update windows CI toolchain to 1.48.0 The hope is that the random LLVM failures will stop, rust-lang/rust#72470 being fixed. Co-authored-by: Tom Houlé <tom@tomhoule.com>
Code
Project is here: https://github.com/kryptan/llvm-error
Compile with
cargo test --release
on Windows-MSVC (compilation on Linux works fine).src/lib.rs
:tests/test.rs
:Meta
I tried two versions of the compiler (LLVM 9 & LLVM 10):
rustc --version --verbose
:rustc --version --verbose
:Error output
The text was updated successfully, but these errors were encountered: