Manually Constructing LoopInfo via Dominator Tree


I noticed one of the earlier posts ( from llvm-dev that talked about "constructing loop info manually without any pass" by doing this:

              llvm::DominatorTree domTree{&func, func};
              llvm::LoopInfo loopInfo{&func, domTree};

However, when I try this in llvm 10.0, I get the following error:

  error: no matching function for call to ‘llvm::DominatorTree::DominatorTree(<brace-enclosed initializer list>)’
              DominatorTree domTree{&F, F};

Am I doing something really silly here? or this manual hack no longer works?


DominatorTree has the following constructor:

  explicit DominatorTree(Function &F);

That is, use

    llvm::DominatorTree DT(func);

to instantiate it.