[GISel] TreeMatcher: always skip leaves if they don't care
authorKai Nacke <kai.peter.nacke@ibm.com>
Mon, 19 Sep 2022 16:03:32 +0000 (16:03 +0000)
committerKai Nacke <kai.peter.nacke@ibm.com>
Tue, 20 Sep 2022 20:55:02 +0000 (20:55 +0000)
commit34a809591bf97bd8832dbbabd7f0b7f7a3355783
tree04df1f4b431dcbc993a544136e54d3f2310fdc52
parentb9a371f6d1509c4a29c9131e433dd2cf275dc6f1
[GISel] TreeMatcher: always skip leaves if they don't care

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.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D134192
llvm/test/TableGen/GICombinerEmitter/match-tree.td
llvm/utils/TableGen/GlobalISel/GIMatchTree.cpp