[llvm] be0ffbb - [TableGen] Run GenerateVariants before ExpandHwModeBasedTypes.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 16 15:08:43 PDT 2021


Author: Craig Topper
Date: 2021-04-16T15:05:33-07:00
New Revision: be0ffbb21f6631a73679d371da5315db3eb3537c

URL: https://github.com/llvm/llvm-project/commit/be0ffbb21f6631a73679d371da5315db3eb3537c
DIFF: https://github.com/llvm/llvm-project/commit/be0ffbb21f6631a73679d371da5315db3eb3537c.diff

LOG: [TableGen] Run GenerateVariants before ExpandHwModeBasedTypes.

A large portion of the patterns are duplicated for HwMode on RISCV.
If we expand HwMode first, we need to check nearly twice as many
patterns for variants. HwModes shouldn't affect whether a variant
is valid so we should be able to expand after.

This also reduces the RISCV isel table by 539 bytes due to factoring
working better on this pattern order. Unfortunately it increases
Hexagon table size by ~50 bytes. But I think this is a reasonable
trade.

Added: 
    

Modified: 
    llvm/utils/TableGen/CodeGenDAGPatterns.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index dff346477a05..43486880933c 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -3086,15 +3086,15 @@ CodeGenDAGPatterns::CodeGenDAGPatterns(RecordKeeper &R,
   ParsePatternFragments(/*OutFrags*/true);
   ParsePatterns();
 
+  // Generate variants.  For example, commutative patterns can match
+  // multiple ways.  Add them to PatternsToMatch as well.
+  GenerateVariants();
+
   // Break patterns with parameterized types into a series of patterns,
   // where each one has a fixed type and is predicated on the conditions
   // of the associated HW mode.
   ExpandHwModeBasedTypes();
 
-  // Generate variants.  For example, commutative patterns can match
-  // multiple ways.  Add them to PatternsToMatch as well.
-  GenerateVariants();
-
   // Infer instruction flags.  For example, we can detect loads,
   // stores, and side effects in many cases by examining an
   // instruction's pattern.


        


More information about the llvm-commits mailing list