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

behavior tests are tripping an LLVM assert when CPU has avx512f feature #17514

Closed
andrewrk opened this issue Oct 13, 2023 · 3 comments
Closed
Labels
arch-x86_64 64-bit x86 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

@andrewrk
Copy link
Member

zig version: 0.12.0-dev.903+7aa85691b

$ stage4/bin/zig test ../test/behavior.zig -I../test -mcpu=x86_64+avx512f
LLVM Emit Object... zig: /home/andy/Downloads/llvm-project-17/llvm/lib/Target/X86/X86ISelLowering.cpp:25856: llvm::SDValue LowerVSETCC(llvm::SDValue, const llvm::X86Subtarget&, llvm::SelectionDAG&): Assertion `(VTOp0.getScalarSizeInBits() >= 32 || Subtarget.hasBWI()) && "Unexpected operand type"' failed.
Aborted (core dumped)

Not sure what Zig code is triggering this yet but it seems related to vectors:

Thread 1 "zig" received signal SIGABRT, Aborted.
0x00007ffff7d64adc in __pthread_kill_implementation ()
   from /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6
(gdb) bt
#0  0x00007ffff7d64adc in __pthread_kill_implementation ()
   from /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6
#1  0x00007ffff7d15cb6 in raise ()
   from /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6
#2  0x00007ffff7cff8ba in abort ()
   from /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6
#3  0x00007ffff7cff7d9 in __assert_fail_base.cold ()
   from /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6
#4  0x00007ffff7d0e9c6 in __assert_fail ()
   from /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6
#5  0x000000000c1241e6 in LowerVSETCC(llvm::SDValue, llvm::X86Subtarget const&, llvm::SelectionDAG&) ()
#6  0x000000000aa88ea7 in (anonymous namespace)::VectorLegalizer::LegalizeOp(llvm::SDValue) ()
#7  0x000000000aa8753d in (anonymous namespace)::VectorLegalizer::LegalizeOp(llvm::SDValue) ()
#8  0x000000000aa8a5b3 in llvm::SelectionDAG::LegalizeVectors() ()
#9  0x000000000a9926a8 in llvm::SelectionDAGISel::CodeGenAndEmitDAG() ()
#10 0x000000000a996567 in llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) ()
#11 0x000000000a9981c4 in llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) [clone .part.0] ()
#12 0x000000000c337d8c in (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) ()
#13 0x0000000009ca9985 in llvm::MachineFunctionPass::runOnFunction(llvm::Function&) [clone .part.0] ()
#14 0x0000000008b75976 in llvm::FPPassManager::runOnFunction(llvm::Function&) ()
#15 0x0000000008b75ba1 in llvm::FPPassManager::runOnModule(llvm::Module&) ()
#16 0x0000000008b76463 in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
#17 0x000000000881cbc5 in ZigLLVMTargetMachineEmitToFile ()
#18 0x0000000006ae9add in codegen.llvm.Object.flushModule (self=0xfb27100, comp=0xfb24570,
    prog_node=0x7ffffffefe38) at /home/andy/Downloads/zig/src/codegen/llvm.zig:1277
@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior arch-x86_64 64-bit x86 backend-llvm The LLVM backend outputs an LLVM IR Module. labels Oct 13, 2023
@andrewrk andrewrk added this to the 0.12.0 milestone Oct 13, 2023
@jacobly0
Copy link
Member

jacobly0 commented Oct 14, 2023

reduction:

export fn entry() void {
    var v = @Vector(4, u1){ 0, 0, 0, 0 };
    var r = @addWithOverflow(v, v);
    _ = r;
}
$ zig build-obj repro.zig -mcpu=x86_64+avx512f
LLVM Emit Object... zig: llvm/lib/Target/X86/X86ISelLowering.cpp:25857: SDValue LowerVSETCC(SDValue, const X86Subtarget &, SelectionDAG &): Assertion `(VTOp0.getScalarSizeInBits() >= 32 || Subtarget.hasBWI()) && "Unexpected operand type"' failed.
Aborted (core dumped)

upstream: llvm/llvm-project#69080

@andrewrk andrewrk added the upstream An issue with a third party project that Zig uses. label Oct 14, 2023
@andrewrk andrewrk modified the milestones: 0.12.0, 0.13.0 Jan 31, 2024
@alexrp
Copy link
Member

alexrp commented Aug 31, 2024

This no longer reproduces.

@alexrp alexrp mentioned this issue Aug 31, 2024
7 tasks
@andrewrk
Copy link
Member Author

Fixed with the merge of LLVM 19 branch in c6ad452.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-x86_64 64-bit x86 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

Successfully merging a pull request may close this issue.

3 participants