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 backend: llvm assert hit when compiling for mips and passing vector for f80 to a function #16479

Open
antlilja opened this issue Jul 21, 2023 · 6 comments
Labels
arch-mips 32-bit and 64-bit MIPS backend-llvm The LLVM backend outputs an LLVM IR Module. bug Observed behavior contradicts documented or intended behavior upstream An issue with a third party project that Zig uses.
Milestone

Comments

@antlilja
Copy link
Contributor

Zig Version

0.11.0-dev.4059+17255bed4

Steps to Reproduce and Observed Behavior

The compiler hits an LLVM assert when passing a f80 vector to a function and compiling for mips

zig test test.zig -target mips64-linux-none (with a zig compiler linked to a debug version of LLVM)

// test.zig

fn foo(vec: @Vector(1, f80)) void {
    _ = vec;
}

test "test" {
    var x = foo(@Vector(1, f80){0.0});
    _ = x;
}
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:767: getCopyToPartsVector: Assertion `Val.getValueType() == BuiltVectorTy && "Unexpected vector value type"' failed.

It seems to be and issue with LLVM itself and has already been reported in the LLVM issue tracker. But I thought it wouldn't hurt to file an issue if anyone else runs into it.

Expected Behavior

Does not crash

@antlilja antlilja added the bug Observed behavior contradicts documented or intended behavior label Jul 21, 2023
@andrewrk andrewrk added backend-llvm The LLVM backend outputs an LLVM IR Module. upstream An issue with a third party project that Zig uses. labels Jul 22, 2023
@andrewrk andrewrk added this to the 0.12.0 milestone Jul 22, 2023
@andrewrk andrewrk added the arch-mips 32-bit and 64-bit MIPS label Jul 22, 2023
@andrewrk
Copy link
Member

Thanks for reporting the issue upstream!

@tgross35
Copy link

tgross35 commented Mar 7, 2024

Is this closed since llvm/llvm-project@e49103b was applied?

@Rexicon226
Copy link
Contributor

Is this closed since llvm/llvm-project@e49103b was applied?

No, because this was applied to a version of LLVM that we haven't upgraded to yet. The error still happens in master branch.

@nektro
Copy link
Contributor

nektro commented Mar 7, 2024

that commit made it into llvm 17 so if it fixed the issue it would already be fixed on zig master. so it seems there's more investigating to be done.

@Rexicon226
Copy link
Contributor

Rexicon226 commented Mar 7, 2024

that commit made it into llvm 17 so if it fixed the issue it would already be fixed on zig master. so it seems there's more investigating to be done.

You're right, I missread the date of the commit 😄

The current error I'm getting on master is the same one antilja reported. However the reduced case reported in the LLVM issue passes for me now. So it seems there is another edge case here of some sort.

EDIT:
Sort of.
image
Running with build-exe causes the assertion, however building the IR with llc works fine.

@alexrp
Copy link
Member

alexrp commented Oct 3, 2024

Still happens with LLVM 19:

/home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:811: void getCopyToPartsVector(llvm::SelectionDAG&, const llvm::SDLoc&, llvm::SDValue, llvm::SDValue*, unsigned int, llvm::MVT, const llvm::Value*, std::optional<unsigned int>): Assertion `Val.getValueType() == BuiltVectorTy && "Unexpected vector value type"' failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-mips 32-bit and 64-bit MIPS backend-llvm The LLVM backend outputs an LLVM IR Module. bug Observed behavior contradicts documented or intended behavior upstream An issue with a third party project that Zig uses.
Projects
None yet
Development

No branches or pull requests

6 participants