diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp --- a/llvm/utils/TableGen/GlobalISelEmitter.cpp +++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp @@ -3359,9 +3359,11 @@ static Expected getInstResultType(const TreePatternNode *Dst) { ArrayRef ChildTypes = Dst->getExtTypes(); - if (ChildTypes.size() != 1) - return failedImport("Dst pattern child has multiple results"); + if (ChildTypes.size() < 1) + return failedImport("Dst pattern child has no result"); + // If there are multiple results, just take the first one (this is how + // SelectionIDAG does it). Optional MaybeOpTy; if (ChildTypes.front().isMachineValueType()) { MaybeOpTy = @@ -4753,8 +4755,9 @@ // We don't have a leaf node, so we have to try and infer something. Check // that we have an instruction that we an infer something from. - // Only handle things that produce a single type. - if (N->getNumTypes() != 1) + // Only handle things that produce at least one value (if multiple values, + // just take the first one). + if (N->getNumTypes() < 1) return None; Record *OpRec = N->getOperator();