Skip to content
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: "Vector elements must have same size" with -Zmir-opt-level=3 #104037

Open
matthiaskrgr opened this issue Nov 6, 2022 · 2 comments
Open
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-mir-opt Area: MIR optimizations C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-debug-assertions This issue requires a build of rustc or tooling with debug-assertions in some way T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Nov 6, 2022

Code

You may need a debug-assertions build of llvm to reproduce this.
Interestingly this only triggers with mir-opt-level 3 but not with 2.

#[derive(Clone)]
pub struct Foo(Bar, u32);

#[derive(Clone, Copy)]
pub struct Bar(u8, u8, u8);

fn main() {
    let foo: Vec<Foo> = Vec::new();
    let _ = foo.clone();
}

Meta

rustc --version --verbose:

rustc @ 371100b1fb811e604f7451eff3b06960587fe1af with full rustc + llvm debug assertions

Error output

rustc -Copt-level=3 103380.rs

rustc: /home/matthias/vcs/github/rust_debug_assertions/src/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:2907: llvm::Value *llvm::InnerLoopVectorizer::createBitOrPointerCast(llvm::Value *, llvm::VectorType *, const llvm::DataLayout &): Assertion `(DL.getTypeSizeInBits(SrcElemTy) == DL.getTypeSizeInBits(DstElemTy)) && "Vector elements must have same size"' failed.
Backtrace

rustc: /home/matthias/vcs/github/rust_debug_assertions/src/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:2907: llvm::Value *llvm::InnerLoopVectorizer::createBitOrPointerCast(llvm::Value *, llvm::VectorType *, const llvm::DataLayout &): Assertion `(DL.getTypeSizeInBits(SrcElemTy) == DL.getTypeSizeInBits(DstElemTy)) && "Vector elements must have same size"' failed.

@matthiaskrgr matthiaskrgr added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. A-mir-opt Area: MIR optimizations requires-debug-assertions This issue requires a build of rustc or tooling with debug-assertions in some way labels Nov 6, 2022
@nikic
Copy link
Contributor

nikic commented Nov 6, 2022

This is likely the same issue as llvm/llvm-project#58722.

@matthiaskrgr
Copy link
Member Author

Probably :) , I looked for the assertion message in the rustc issue tracker but couldn't find anything related 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-mir-opt Area: MIR optimizations C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-debug-assertions This issue requires a build of rustc or tooling with debug-assertions in some way T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants