Compiler gets stuck in Infinite (so far) loop
Validark opened this issue · 4 comments
Zig Version
0.13.0-dev.75+5c9eb4081
Steps to Reproduce and Observed Behavior
https://zig.godbolt.org/z/GYdeh839e
Compiling this code for Zen 4:
export fn popCount(x: @Vector(8, u64)) u64 {
return @reduce(.Add, @popCount(x));
}
Takes forever (so far). I have reproduced this on my machine for the version indicated (0.13.0-dev.75+5c9eb4081
), and also noted that it times out 0.11.0 and 0.12.0 in compiler explorer.
Expected Behavior
The program to terminate at some point, preferably compiling the code!
this isnt reproducing for me locally on 0.13.0-dev.201+86d8688c7
. fixed in the llvm 18 upgrade maybe?
Indeed, this spits out an LLVM assertion on my pre-LLVM18 build:
LLVM Emit Object... zig: /home/mlugg/llvm17/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:982: void {anonymous}::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*): Assertion `(TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || Op.getOpcode() == ISD::TargetConstant || Op.getOpcode() == ISD::Register) && "Unexpected illegal type!"' failed.
I'm willing to bet this was indeed fixed with the LLVM 18 upgrade, but to be sure, I will wait for someone with a debug build of a post-LLVM18 compiler to confirm that no assertion is tripped.
that's a dupe: andrew filed llvm/llvm-project#90356 and fixed in 18.1.x
confirmed:
zig 0.12.0
w/llvm-17.0.6 release+assert
trips assertionzig 0.12.0
w/llvm-17.0.6 release
spins infinitezig master
w/llvm-18.1.5 release+assert
does not trip assertion (builds object)zig master
w/llvm-18.1.5 release
builds object
Cool!