[PATCH] D26872: Outliner: Add MIR-level outlining pass

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 10:40:35 PST 2017


paquette updated this revision to Diff 89535.
paquette marked 71 inline comments as done.
paquette added a comment.

Alright, it's been a while, but here's the next version of the outlining patch! As always, thanks to everyone taking the time to read through all this code. This version of the outliner is quite different from the previous one, since I've improved on it a lot since the last patch.

**Major changes**

- More LLVM-ey and most comments addressed!

- X86 target won't outline debug instructions anymore. There are other things to think about wrt debug info, which I'm currently working on.

- More tests: Right now, MIR tests with the outliner make LLC unhappy, so I wrote a couple IR tests which should be easy enough to transition to MIR.

- No more ProgramMapping: instead there's another vector which keeps track of the positions of each instruction in the program. It uses iterators because the delete function on MachineBasicBlocks takes a start and end iterator. (If that makes anyone uncomfortable, I can change it to pointers.)

- Improved suffix tree pruning: the previous version was too aggressive and threw out too many candidates. The new version uses a vector of leaves.

- No more unnecessary functions: the previous version had a FIXME stating that sometimes the outliner could create unnecessary functions when all of the candidates for a function were removed. Now overlap pruning happens directly before outlining, so functions are created as they're needed.

- Outlined functions are now link once ODR: This allows the linker to dedupe outlined functions without LTO.

- Mapper class: This class performs the instruction-integer mappings and is passed around the outliner

- General suffix tree queries: Different targets will have different benefit functions, and even different types of functions to outline. For example, after this, I have a version of the outliner which supports tail-calling outlined functions. In the interest of keeping target-specific stuff out of the SuffixTree, the target now defines a benefit function, which is then maximized by the DFS query for repeated substrings. I think this will allow for more fine-grained outlining on various targets.

Tell me what you think!


https://reviews.llvm.org/D26872

Files:
  include/llvm/CodeGen/Passes.h
  include/llvm/InitializePasses.h
  include/llvm/Target/TargetInstrInfo.h
  lib/CodeGen/CMakeLists.txt
  lib/CodeGen/CodeGen.cpp
  lib/CodeGen/MachineOutliner.cpp
  lib/CodeGen/TargetPassConfig.cpp
  lib/Target/X86/X86InstrInfo.cpp
  lib/Target/X86/X86InstrInfo.h
  test/CodeGen/X86/machine-outliner-basic.ll
  test/CodeGen/X86/machine-outliner-bb-boundaries.ll
  test/CodeGen/X86/machine-outliner-interprocedural.ll
  test/CodeGen/X86/machine-outliner-nocalls.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26872.89535.patch
Type: text/x-patch
Size: 70287 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170223/d282bdf5/attachment.bin>


More information about the llvm-commits mailing list