[PATCH] D26871: Outliner: Add a suffix tree type for the outliner

Jessica Paquette via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 18 14:26:02 PST 2016


paquette created this revision.
paquette added reviewers: MatzeB, qcolombet, echristo, chandlerc, dblaikie.
paquette added a subscriber: llvm-commits.
paquette set the repository for this revision to rL LLVM.
Herald added subscribers: modocache, mgorny, mehdi_amini.

This is the second patch out of three necessary for upstreaming the outliner described in the RFC at http://lists.llvm.org/pipermail/llvm-dev/2016-August/104170.html

This patch relies on https://reviews.llvm.org/D26870

In order to find candidates for outlining, we put the entire program into a TerminatedStringList of integer mappings from MachineInstrs. We then put the TerminatedStringList into a suffix tree type. Suffix trees support efficient substring queries. Specifically, they allow us to quickly query for repeated substrings in a program which serve as outlining candidates.

Furthermore, the suffix tree would serve as an interesting code analysis tool. For example, it could be used for finding regions of code which are highly similar, such as copied/pasted code. Or, alternatively, it could be used to find potential code size reduction opportunities that the outliner can't necessarily safely outline.


Repository:
  rL LLVM

https://reviews.llvm.org/D26871

Files:
  include/llvm/ADT/SuffixTree.h
  unittests/ADT/CMakeLists.txt
  unittests/ADT/SuffixTreeTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26871.78580.patch
Type: text/x-patch
Size: 22456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161118/4b4490a4/attachment.bin>


More information about the llvm-commits mailing list