[PM] Port GVN to the new pass manager, wire it up, and teach a couple of
authorChandler Carruth <chandlerc@gmail.com>
Fri, 11 Mar 2016 08:50:55 +0000 (08:50 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 11 Mar 2016 08:50:55 +0000 (08:50 +0000)
commit89c45a162fe0cfd1fc4f9e246e89b11578552bf9
tree1dc0a6cbfffd60adf9f131a5ad48828afbc9263a
parentcc0e87cdae3ec45da620189b35f2e9b497549f32
[PM] Port GVN to the new pass manager, wire it up, and teach a couple of
tests to run GVN in both modes.

This is mostly the boring refactoring just like SROA and other complex
transformation passes. There is some trickiness in that GVN's
ValueNumber class requires hand holding to get to compile cleanly. I'm
open to suggestions about a better pattern there, but I tried several
before settling on this. I was trying to balance my desire to sink as
much implementation detail into the source file as possible without
introducing overly many layers of abstraction.

Much like with SROA, the design of this system is made somewhat more
cumbersome by the need to support both pass managers without duplicating
the significant state and logic of the pass. The same compromise is
struck here.

I've also left a FIXME in a doxygen comment as the GVN pass seems to
have pretty woeful documentation within it. I'd like to submit this with
the FIXME and let those more deeply familiar backfill the information
here now that we have a nice place in an interface to put that kind of
documentaiton.

Differential Revision: http://reviews.llvm.org/D18019

llvm-svn: 263208
13 files changed:
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/LinkAllPasses.h
llvm/include/llvm/Transforms/Scalar.h
llvm/include/llvm/Transforms/Scalar/GVN.h [new file with mode: 0644]
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Passes/PassRegistry.def
llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
llvm/lib/Transforms/Scalar/GVN.cpp
llvm/lib/Transforms/Scalar/Scalar.cpp
llvm/test/Transforms/GVN/basic.ll
llvm/test/Transforms/GVN/pre-gep-load.ll