diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp --- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp @@ -4266,13 +4266,19 @@ // that register class does not accept that type, the type inference // will lead to a contradiction, which is not an error however, but // a sign that this pattern will simply never match. - if (Temp.getOnlyTree()->hasPossibleType()) - for (const auto &T : Pattern.getTrees()) - if (T->hasPossibleType()) + if (Temp.getOnlyTree()->hasPossibleType()) { + for (const auto &T : Pattern.getTrees()) { + if (T->hasPossibleType()) { AddPatternToMatch(&Pattern, PatternToMatch(TheDef, Preds, T, Temp.getOnlyTree(), InstImpResults, Complexity, TheDef->getID())); + } else { + PrintWarning(Pattern.getRecord()->getLoc(), + Twine("Ignoring pattern with impossible type")); + } + } + } } void CodeGenDAGPatterns::ParsePatterns() {