[llvm] 1b18064 - [TableGen] Print message about dropped patterns with -debug
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Wed May 10 14:52:13 PDT 2023
Author: Krzysztof Parzyszek
Date: 2023-05-10T14:51:57-07:00
New Revision: 1b1806406908c185202bd62b7315f1627bfb5aa7
URL: https://github.com/llvm/llvm-project/commit/1b1806406908c185202bd62b7315f1627bfb5aa7
DIFF: https://github.com/llvm/llvm-project/commit/1b1806406908c185202bd62b7315f1627bfb5aa7.diff
LOG: [TableGen] Print message about dropped patterns with -debug
A selection pattern can be silently dropped if type inference fails to
deduce some types. Print a message when that happens, and -debug was
applied.
Added:
Modified:
llvm/utils/TableGen/CodeGenDAGPatterns.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index ed2eda8f9792..1ce735c82415 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -4333,13 +4333,24 @@ void CodeGenDAGPatterns::ParseOnePattern(Record *TheDef,
// 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 (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 {
+ // Show a message about a dropped pattern with some info to make it
+ // easier to identify it in the .td files.
+ LLVM_DEBUG({
+ dbgs() << "Dropping: ";
+ Pattern.dump();
+ Temp.getOnlyTree()->dump();
+ dbgs() << "\n";
+ });
+ }
}
void CodeGenDAGPatterns::ParsePatterns() {
More information about the llvm-commits
mailing list