[PATCH] D47959: [DAG] Avoid needing to walk out legalization tables. NFCI.

Nirav Dave via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 8 13:40:02 PDT 2018


niravd created this revision.
niravd added reviewers: jyknight, echristo, jlebar.
Herald added a subscriber: hiraditya.

To avoid redundant work, during DAG legalization we keep tables
mapping pre-legalized SDValues to post-legalized SDValues and a
SDValue-to-SDValue map to enable fast node replacements. However, as
the keys are nodes which may be reused it is possible that an entry in
a table refers to a now deleted node N (that should have been renamed
by the Value replacement map) while a new node N' exists. If N' is
then replaced that entry would be wrong. Previously we avoided this by
when potentially violating this property, walking every table and
updating all node pointers. This is very expensive but hopefully rare
occurance.

This patch assigns each instance of a SDValue used in legalization a
unique id and uses these ids in the legalization tables. This avoids
any such aliasing issue, avoiding the full table search and allowing
more aggressive incremental table pruning.

In some cases this is a 1000x speedup to compilation.


Repository:
  rL LLVM

https://reviews.llvm.org/D47959

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
  llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47959.150560.patch
Type: text/x-patch
Size: 23375 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180608/373ffda6/attachment.bin>


More information about the llvm-commits mailing list