Skip to content

Commit 1b18064

Browse files
author
Krzysztof Parzyszek
committed
[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.
1 parent 6561032 commit 1b18064

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

llvm/utils/TableGen/CodeGenDAGPatterns.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4333,13 +4333,24 @@ void CodeGenDAGPatterns::ParseOnePattern(Record *TheDef,
43334333
// that register class does not accept that type, the type inference
43344334
// will lead to a contradiction, which is not an error however, but
43354335
// a sign that this pattern will simply never match.
4336-
if (Temp.getOnlyTree()->hasPossibleType())
4337-
for (const auto &T : Pattern.getTrees())
4336+
if (Temp.getOnlyTree()->hasPossibleType()) {
4337+
for (const auto &T : Pattern.getTrees()) {
43384338
if (T->hasPossibleType())
43394339
AddPatternToMatch(&Pattern,
43404340
PatternToMatch(TheDef, Preds, T, Temp.getOnlyTree(),
43414341
InstImpResults, Complexity,
43424342
TheDef->getID()));
4343+
}
4344+
} else {
4345+
// Show a message about a dropped pattern with some info to make it
4346+
// easier to identify it in the .td files.
4347+
LLVM_DEBUG({
4348+
dbgs() << "Dropping: ";
4349+
Pattern.dump();
4350+
Temp.getOnlyTree()->dump();
4351+
dbgs() << "\n";
4352+
});
4353+
}
43434354
}
43444355

43454356
void CodeGenDAGPatterns::ParsePatterns() {

0 commit comments

Comments
 (0)