[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
Tue Apr 20 11:16:47 PDT 2021


craig.topper added inline comments.


================
Comment at: llvm/utils/TableGen/CodeGenDAGPatterns.cpp:4382
     if (HasDefault)
       AppendPattern(P, DefaultMode);
   }
----------------
kparzysz wrote:
> This should be
> ```
> if (HasDefault) {
>   ModeChecks[DefaultMode] = DefaultPred;
>   AppendPattern(P, DefaultMode);
> }
> ```
That ends up not really working. The ModeChecks are cached for all patterns, but the DefaultPred vector lives inside the loop for a particular pattern. The DefaultPred vector only gets populated when a pattern contains a non-default mode that has never been seen by any pattern before due to the `ModeChecks.find(M) != ModeChecks.end()` in the first mode loop. 

So only one or zero patterns end up getting a default check depending on whether the pattern applies in the default mode.


Is the DefaultPred supposed to be the inverse of the modes that apply to a particular pattern, or the inverse of the predicates for all modes? If the latter you can't calculate it inside the pattern loops and would need to calculate it based on the complete list of modes not just which modes apply to a particular pattern.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100691/new/

https://reviews.llvm.org/D100691



More information about the llvm-commits mailing list