Skip to content

LLVM error: "Instruction does not dominate all uses!" on Windows #72470

Closed
@kryptan

Description

@kryptan

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:

use std::future::Future;
use std::sync::Arc;

pub async fn run() {
    foo(|| async { create() }).await;
    foo(|| async { create() }).await;
}

async fn foo<F>(create: impl Fn() -> F)
where
    F: Future<Output = Struct>,
{
    call_empty::<()>(create().await, "").await;
}

struct Struct {
    _vec: Vec<u8>,
    _arc: Arc<()>,
}

fn create() -> Struct {
    Struct {
        _vec: Vec::new(),
        _arc: Arc::new(()),
    }
}

async fn call_empty<R>(_: Struct, _: &str) {
    empty()
}

fn empty() {}

tests/test.rs:

use std::future::Future;

#[test]
fn test() {
    let _: Box<dyn Future<Output = ()>> = Box::new(llvm_eror::run());
}

Meta

I tried two versions of the compiler (LLVM 9 & LLVM 10):

rustc --version --verbose:

rustc 1.45.0-nightly (9310e3bd4 2020-05-21)
binary: rustc
commit-hash: 9310e3bd4f425f84fc27878ebf2bda1f30935a63
commit-date: 2020-05-21
host: x86_64-pc-windows-msvc
release: 1.45.0-nightly
LLVM version: 10.0

rustc --version --verbose:

rustc 1.45.0-nightly (a74d1862d 2020-05-14)
binary: rustc
commit-hash: a74d1862d4d87a56244958416fd05976c58ca1a8
commit-date: 2020-05-14
host: x86_64-pc-windows-msvc
release: 1.45.0-nightly
LLVM version: 9.0

Error output

Instruction does not dominate all uses!
  %117 = phi i8* [ %117, %111 ], [ %117, %105 ], [ %43, %60 ], [ %43, %58 ], [ %51, %56 ]
  %117 = phi i8* [ %117, %111 ], [ %117, %105 ], [ %43, %60 ], [ %43, %58 ], [ %51, %56 ]
Instruction does not dominate all uses!
  %117 = phi i8* [ %117, %111 ], [ %117, %105 ], [ %43, %60 ], [ %43, %58 ], [ %51, %56 ]
  %117 = phi i8* [ %117, %111 ], [ %117, %105 ], [ %43, %60 ], [ %43, %58 ], [ %51, %56 ]
Instruction does not dominate all uses!
  %228 = phi i8* [ %228, %222 ], [ %228, %216 ], [ %155, %171 ], [ %155, %169 ], [ %162, %167 ]
  %228 = phi i8* [ %228, %222 ], [ %228, %216 ], [ %155, %171 ], [ %155, %169 ], [ %162, %167 ]
Instruction does not dominate all uses!
  %228 = phi i8* [ %228, %222 ], [ %228, %216 ], [ %155, %171 ], [ %155, %169 ], [ %162, %167 ]
  %228 = phi i8* [ %228, %222 ], [ %228, %216 ], [ %155, %171 ], [ %155, %169 ], [ %162, %167 ]
in function _ZN97_$LT$core..future..from_generator..GenFuture$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$4poll17hf4840ccb0415d3e1E
LLVM ERROR: Broken function found, compilation aborted!
error: could not compile `llvm_eror`.

Metadata

Metadata

Assignees

Labels

A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-async-awaitArea: Async & AwaitA-codegenArea: Code generationAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.C-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ICEBreaker-Cleanup-CrewHelping to "clean up" bugs with minimal examples and bisectionsICEBreaker-LLVMBugs identified for the LLVM ICE-breaker groupO-windows-msvcToolchain: MSVC, Operating system: WindowsP-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions