[all-commits] [llvm/llvm-project] 051d33: Avoid creating an immutable map in the Automaton c...

Kariddi via All-commits all-commits at lists.llvm.org
Thu Jan 16 18:45:52 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 051d330314cb1f175025ca37da8e5e1d851e1790
      https://github.com/llvm/llvm-project/commit/051d330314cb1f175025ca37da8e5e1d851e1790
  Author: Marcello Maggioni <hayarms at gmail.com>
  Date:   2020-01-16 (Thu, 16 Jan 2020)

  Changed paths:
    M llvm/include/llvm/Support/Automaton.h
    M llvm/utils/TableGen/DFAEmitter.cpp

  Log Message:
  -----------
  Avoid creating an immutable map in the Automaton class.

Summary:
In the DFAPacketizer we copy the Transitions array
into a map in order to later access the transitions
based on a "Current State/Action" pair as a key.
This map lives in the Automaton object used by the DFAPacketizer.
It is never changed during the life of the object after
having been created during the creation of the Automaton
itself.

This map creation can make the creation of a DFAPacketizer
quite expensive if the target contains a considerable
amount of transition states.

Considering that TableGen already generates a
sorted list of transitions by State/Action pairs
we could just use that directly in our Automaton
and search entries with std::lower_bound instead of copying
it in a map and paying the execution time and memory cost.

Reviewers: jmolloy, ThomasRaoux

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D72682




More information about the All-commits mailing list