llvm-project
llvm-project copied to clipboard
"Illegal VarBitInit expression!" assertion failed in llvm-tblgen
With this example:
class A<bits<8> op> {
bits<8> f = op;
}
multiclass B<bits<8> op> {
def : A<op>;
}
multiclass C<bits<4> op> : B<op>;
defm D : C<0>;
I get:
$ llvm-tblgen crash.td
llvm-tblgen: include/llvm/TableGen/Record.h:1285: llvm::VarBitInit::VarBitInit(llvm::TypedInit *, unsigned int): Assertion `T->getType() && (isa<IntRecTy>(T->getType()) || (isa<BitsRecTy>(T->getType()) && cast<BitsRecTy>(T->getType())->getNumBits() > B)) && "Illegal VarBitInit expression!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
It looks like some missing type checking when multiclass C passes its bits<4> argument into multiclass B which was expecting a bits<8>.
Here's another repro for the same error message:
class C<bit val> {
bits<32> word;
bit flag;
let word{0} = !cond(val : flag);
}
class D<bit val> : C<val>;
https://github.com/llvm/llvm-project/pull/197128 is the resolution , @jayfoad . : )