[PATCH] D100691: [TableGen] Store predicates in PatternToMatch as ListInit *. Add string for HwModeFeatures

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 16 16:10:01 PDT 2021


craig.topper created this revision.
craig.topper added reviewers: RKSimon, Paul-C-Anagnostopoulos, kparzysz.
Herald added subscribers: luismarques, pengfei, s.egerton, PkmX, mgrang, simoncook, tpr.
craig.topper requested review of this revision.
Herald added a project: LLVM.

This uses to be how predicates were handled prior to HwMode being
added. When the Predicates were converted to a std::vector it
significantly increased the cost of a a compare in GenerateVariants.
Since ListInit's are uniquified by tablegen, we can use a simple
pointer comparison to check for identical lists.

In order to store the HwMode, we now add a separate string to
PatterntToMatch. This will be appended separately to the predicate
string in getPredicateCheck. A new getPredicateRecords is added
to allow GlobalISel and getPredicateCheck to both get the sorted
list of Records. GlobalISel was ignoring any HwMode predicates
before and still is.

There is one slight change here, ListInits with different predicate
orders aren't sorted so the filtering in GenerateVariants might
fail to detect two isomorphic patterns with different predicate
orders. This doesn't seem to be happening in tree today.

My hope is this will allow us to remove all the BitVector tracking
in GenerateVariants that was making up for predicates beeing
expensive to compare. There's a decent amount of heap allocations
there on large targets like X86, AMDGPU, and RISCV.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100691

Files:
  llvm/utils/TableGen/CodeGenDAGPatterns.cpp
  llvm/utils/TableGen/CodeGenDAGPatterns.h
  llvm/utils/TableGen/GlobalISelEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100691.338256.patch
Type: text/x-patch
Size: 14998 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210416/e351fb04/attachment.bin>


More information about the llvm-commits mailing list