Skip to content

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

Closed

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`.

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on May 22, 2020
  2. added
    A-codegenArea: Code generation
    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    O-windows-msvcToolchain: MSVC, Operating system: Windows
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    on May 22, 2020
  3. jonas-schievink commented on May 22, 2020

    @jonas-schievink
    Contributor

    Regression from rustc 1.45.0-nightly (bad3bf6 2020-05-09) to rustc 1.45.0-nightly (9912925 2020-05-10)

    bad3bf6...9912925

    Further bisection might be needed

  4. added
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on May 22, 2020
  5. jonas-schievink commented on May 22, 2020

    @jonas-schievink
    Contributor

    A smaller reproduction would be useful (if that's possible), marking needs-mcve

  6. jonas-schievink commented on May 23, 2020

    @jonas-schievink
    Contributor

    @rustbot ping cleanup

  7. 37 remaining items

  8. Aaron1011 commented on Oct 2, 2020

    @Aaron1011
    Contributor

    A bisect shows that this was fixed by the upgrade to LLVM 11 in #73526. I'm going to try-relanding the original PR.

  9. tmandry commented on Oct 6, 2020

    @tmandry
    Member

    Fixed by #77466.

  10. added a commit that references this issue on Dec 23, 2020
  11. added a commit that references this issue on Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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) ❄️O-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

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions