I want to add “mem2reg” pass similar to this:
PM.add(new Mem2Reg()); // What’s the class name for this pass
I couldn’t find the name of corresponding class and header file of mem2reg pass except “mem2reg.cpp”. So how can I add mem2reg pass into my pass manager?
PM.add(createPromoteMemoryToRegisterPass()) works for me. Hope this helpful.
Did you include "Mem2Reg.cpp"?
$ grep createPromoteMemoryToRegisterPass include -R
include/llvm/LinkAllPasses.h: (void) llvm::createPromoteMemoryToRegisterPass();
It seem this should be enough: #include “llvm/Transforms/Scalar.h”