This is an archive of the discontinued LLVM Phabricator instance.

[GISel] TreeMatcher: always skip leaves if they don't care
ClosedPublic

Authored by Kai on Sep 19 2022, 9:23 AM.

Details

Summary

In GIMatchTreeOpcodePartitioner::applyForPartition(), the loop over
the possible leaves skip a leaf if the instruction does not care
about the instruction.
When processing the referenced operands in the next loop the same
leaves need to be skipped.

Later, when these leaves are added to all partitions, the bit vector
must be resized first before the bit representing the leaf is set.

This fixes a crash in llvm-tblgen.

Diff Detail

Event Timeline

Kai created this revision.Sep 19 2022, 9:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2022, 9:23 AM
Kai requested review of this revision.Sep 19 2022, 9:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2022, 9:23 AM
arsenm accepted this revision.Sep 19 2022, 10:20 AM

LGTM with nit

llvm/test/TableGen/GICombinerEmitter/match-tree.td
80

Should add a comment explaining what this tests

This revision is now accepted and ready to land.Sep 19 2022, 10:20 AM
Kai updated this revision to Diff 461339.Sep 19 2022, 1:38 PM
Kai edited the summary of this revision. (Show Details)
  • Adds a resize when adding the leaves which do not care about the instruction to all partitions, as it is done already in addToPartition()
  • Adds a comment to the test. The test just follows the edges in the graph, to make sure the construction is correct.
Kai updated this revision to Diff 461594.Sep 20 2022, 9:42 AM

Fix formatting complain from clang-format.

arsenm accepted this revision.Sep 20 2022, 11:07 AM

LGTM but I don't see the comment

llvm/test/TableGen/GICombinerEmitter/match-tree.td
80

I don't see the comment here?

Kai updated this revision to Diff 461664.Sep 20 2022, 12:56 PM

Add comment (again? hm.).

arsenm accepted this revision.Sep 20 2022, 12:57 PM
Kai marked 2 inline comments as done.Sep 20 2022, 12:57 PM
Kai added inline comments.
llvm/test/TableGen/GICombinerEmitter/match-tree.td
80

Sorry, now its there.

This revision was automatically updated to reflect the committed changes.
Kai marked an inline comment as done.