[PM] Separate the InstCombiner from its pass.

This creates a small internal pass which runs the InstCombiner over
a function. This is the hard part of porting InstCombine to the new pass
manager, as at this point none of the code in InstCombine has access to
a Pass object any longer.

The resulting interface for the InstCombiner is pretty terrible. I'm not
planning on leaving it that way. The key thing missing is that we need
to separate the worklist from the combiner a touch more. Once that's
done, it should be possible for *any* part of LLVM to just create
a worklist with instructions, populate it, and then combine it until
empty. The pass will just be the (obvious and important) special case of
doing that for an entire function body.

For now, this is the first increment of factoring to make all of this
work.

llvm-svn: 226618
diff --git a/llvm/lib/Transforms/InstCombine/InstCombine.h b/llvm/lib/Transforms/InstCombine/InstCombine.h
index f22b5b0..e404581b 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombine.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombine.h
@@ -104,8 +104,7 @@
 /// combine them, as well as the pass infrastructure for running this as part
 /// of the LLVM pass pipeline.
 class LLVM_LIBRARY_VISIBILITY InstCombiner
-    : public FunctionPass,
-      public InstVisitor<InstCombiner, Instruction *> {
+    : public InstVisitor<InstCombiner, Instruction *> {
   AssumptionCache *AC;
   const DataLayout *DL;
   TargetLibraryInfo *TLI;
@@ -124,21 +123,16 @@
   typedef IRBuilder<true, TargetFolder, InstCombineIRInserter> BuilderTy;
   BuilderTy *Builder;
 
-  static char ID; // Pass identification, replacement for typeid
-  InstCombiner()
-      : FunctionPass(ID), DL(nullptr), DT(nullptr), LI(nullptr),
-        Builder(nullptr) {
+  InstCombiner() : DL(nullptr), DT(nullptr), LI(nullptr), Builder(nullptr) {
     MinimizeSize = false;
-    initializeInstCombinerPass(*PassRegistry::getPassRegistry());
   }
 
 public:
-  bool runOnFunction(Function &F) override;
+  bool run(Function &F, AssumptionCache *AC, const DataLayout *DL,
+           TargetLibraryInfo *TLI, DominatorTree *DT, LoopInfo *LI);
 
   bool DoOneIteration(Function &F, unsigned ItNum);
 
-  void getAnalysisUsage(AnalysisUsage &AU) const override;
-
   AssumptionCache *getAssumptionCache() const { return AC; }
 
   const DataLayout *getDataLayout() const { return DL; }