]> granicus.if.org Git - llvm/commit
[DFAPacketizer] Fix large compile-time regression for VLIW targets
authorJames Molloy <jmolloy@google.com>
Fri, 18 Oct 2019 14:48:35 +0000 (14:48 +0000)
committerJames Molloy <jmolloy@google.com>
Fri, 18 Oct 2019 14:48:35 +0000 (14:48 +0000)
commit0c0ff352fb60616a9b2c67e9eac5f740ded1b063
tree0d43feadd8acc630ce0e9d331e93f6a0c8aad834
parent5a83851b8250a685cb4bb34f6d743bc87dd9ff95
[DFAPacketizer] Fix large compile-time regression for VLIW targets

D68992 / rL375086 refactored the packetizer and removed a bunch of logic. Unfortunately it creates an Automaton object whenever a DFAPacketizer is required. These objects have no longevity, and in particular on a debug build the population of the Automaton's transition map from the underlying table is very slow (because it is called ~10 times per MachineFunction, in the testcase I'm looking at).

This patch changes Automaton to wrap its underlying constant data in std::shared_ptr, which allows trivial copy construction. The DFAPacketizer creation function now creates a static archetypical Automaton and copies that whenever a new DFAPacketizer is required.

This takes a testcase down from ~20s to ~0.5s in debug mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375240 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/Automaton.h
utils/TableGen/DFAPacketizerEmitter.cpp