Index: llvm/trunk/include/llvm/TableGen/Record.h =================================================================== --- llvm/trunk/include/llvm/TableGen/Record.h +++ llvm/trunk/include/llvm/TableGen/Record.h @@ -1241,6 +1241,8 @@ bool setValue(Init *V) { if (V) { Value = V->convertInitializerTo(getType()); + assert(!Value || !isa(Value) || + cast(Value)->getType()->typeIsConvertibleTo(getType())); return Value == nullptr; } Value = nullptr; Index: llvm/trunk/lib/TableGen/Record.cpp =================================================================== --- llvm/trunk/lib/TableGen/Record.cpp +++ llvm/trunk/lib/TableGen/Record.cpp @@ -478,6 +478,9 @@ if (ListInit *I = ThePool.FindNodeOrInsertPos(ID, IP)) return I; + assert(Range.empty() || !isa(Range[0]) || + cast(Range[0])->getType()->typeIsConvertibleTo(EltTy)); + void *Mem = Allocator.Allocate(totalSizeToAlloc(Range.size()), alignof(ListInit)); ListInit *I = new(Mem) ListInit(Range.size(), EltTy);