[all-commits] [llvm/llvm-project] 07edd7: [TableGen] Reduce the number of map lookups in Typ...

Craig Topper via All-commits all-commits at lists.llvm.org
Thu Apr 15 12:33:29 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 07edd789939238d309d2ab747fad79337d705909
      https://github.com/llvm/llvm-project/commit/07edd789939238d309d2ab747fad79337d705909
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-04-15 (Thu, 15 Apr 2021)

  Changed paths:
    M llvm/utils/TableGen/CodeGenDAGPatterns.h

  Log Message:
  -----------
  [TableGen] Reduce the number of map lookups in TypeSetByHwMode::getOrCreate. NFCI

hasMode was looking up the map once. Then we'd either call get which
would look up again, or we'd insert into the map which requires
walking the map to find the insertion point.

I believe the hasMode was needed because get has a special case
to look for DefaultMode if the mode being asked for doesn't exist.
We don't want that here so we were using hasMode to make sure we
wouldn't hit that case.

Simplify to a regular operator[] access which will default
construct a SetType if the lookup fails.




More information about the All-commits mailing list