[PATCH] D105925: [TableGen] Warn when patterns are ignored due to impossible types
Thomas Lively via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 13 11:53:40 PDT 2021
tlively created this revision.
tlively added a reviewer: kparzysz.
Herald added subscribers: wingo, JDevlieghere.
tlively requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
There are some typing problems that cause TableGen to silently ignore CodeGen
patterns, which makes for a surprising and frustrating development workflow. To
clue developers in when their patterns are being ignored, emit a warning.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D105925
Files:
llvm/utils/TableGen/CodeGenDAGPatterns.cpp
Index: llvm/utils/TableGen/CodeGenDAGPatterns.cpp
===================================================================
--- llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ 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() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105925.358380.patch
Type: text/x-patch
Size: 1149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210713/3c932d77/attachment.bin>
More information about the llvm-commits
mailing list