diff options
Diffstat (limited to 'llvm/lib/TableGen/Record.cpp')
| -rw-r--r-- | llvm/lib/TableGen/Record.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp index aa981fdab4b3..2b3e8a0c7f84 100644 --- a/llvm/lib/TableGen/Record.cpp +++ b/llvm/lib/TableGen/Record.cpp @@ -923,15 +923,16 @@ Init *UnOpInit::Fold(Record *CurRec, bool IsFinal) const { case GETDAGOP: if (DagInit *Dag = dyn_cast<DagInit>(LHS)) { - DefInit *DI = DefInit::get(Dag->getOperatorAsDef({})); - if (!DI->getType()->typeIsA(getType())) { + // TI is not necessarily a def due to the late resolution in multiclasses, + // but has to be a TypedInit. + auto *TI = cast<TypedInit>(Dag->getOperator()); + if (!TI->getType()->typeIsA(getType())) { PrintFatalError(CurRec->getLoc(), - Twine("Expected type '") + - getType()->getAsString() + "', got '" + - DI->getType()->getAsString() + "' in: " + - getAsString() + "\n"); + Twine("Expected type '") + getType()->getAsString() + + "', got '" + TI->getType()->getAsString() + + "' in: " + getAsString() + "\n"); } else { - return DI; + return Dag->getOperator(); } } break; |
