This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Encode CheckPatternPredicate num in VBR format to expand the range it can represents
AbandonedPublic

Authored by zixuan-wu on Aug 3 2023, 12:08 AM.

Details

Summary

As the pattern predicate number is growing, SelectionDAG MatcherTable type of char is too small to hold the number directly. So use VBR format to encode the num like what CheckOrImm does.

Diff Detail

Event Timeline

zixuan-wu created this revision.Aug 3 2023, 12:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2023, 12:08 AM
zixuan-wu requested review of this revision.Aug 3 2023, 12:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2023, 12:08 AM

This is definitely not the right fix. We can use a variable bit encoding for the predicate like we do for CheckInteger, CheckAndImm, CheckOrImm, etc.

zixuan-wu updated this revision to Diff 546748.Aug 3 2023, 1:54 AM
zixuan-wu retitled this revision from [PoC][SelectionDAG] Upgrade the MatcherTable type from unsigned char to unsigned short to [SelectionDAG] Encode CheckPatternPredicate num in VBR format to expand the range it can represents.
zixuan-wu edited the summary of this revision. (Show Details)

Address comments.

Can you measure the size impact to the X86 and RISC-V tables?

Can you measure the size impact to the X86 and RISC-V tables?

Here is the data after patch.

Before :
RISCV - // Total Array size is 2368318 bytes
X86 -   // Total Array size is 680816 bytes

After:
RISCV - // Total Array size is 2372208 bytes
X86 -   // Total Array size is 686351 bytes
bogner accepted this revision.Aug 4 2023, 6:26 PM
This revision is now accepted and ready to land.Aug 4 2023, 6:26 PM
craig.topper requested changes to this revision.Aug 5 2023, 12:58 PM

Hold up on this I might have an alternate proposal.

This revision now requires changes to proceed.Aug 5 2023, 12:58 PM

I've posted https://reviews.llvm.org/D157196 as alternative that won't impact X86 or other targets that already have more than 128 predicates.

bogner requested changes to this revision.Aug 5 2023, 1:39 PM

I think we can abandon this and go with Craig's two-opcode approach.

zixuan-wu abandoned this revision.Aug 6 2023, 7:50 PM