[llvm-dev] Running opt O1 outside of llvm

Akash Banerjee via llvm-dev llvm-dev at lists.llvm.org
Sat Apr 4 10:35:56 PDT 2020


Hi,
I would like to run the -O1 pass sequence followed by -reg2mem from an out
of tree project which uses llvm.
I am using the following code snippet to do so but in some cases, my method
is also vectorising the code, which doesn't happen when running the same
sequence(-S -O1 -reg2mem) through opt. Can someone please help me find what
I am missing?

Thanks,
Akash.




















* PassManagerBuilder PM; PM.OptLevel = 1; PM.SizeLevel = 0;
legacy::FunctionPassManager FPM(&llvm_module); legacy::PassManager MPM;
PM.Inliner = createAlwaysInlinerLegacyPass(); PM.DisableUnrollLoops = true;
PM.populateFunctionPassManager(FPM); PM.populateModulePassManager(MPM);
FPM.doInitialization(); for (auto &F : llvm_module)    FPM.run(F);
FPM.doFinalization(); MPM.run(llvm_module); legacy::FunctionPassManager
FPM(&llvm_module); FPM.add(createDemoteRegisterToMemoryPass());
FPM.doInitialization(); for (auto &F : llvm_module)    FPM.run(F);
FPM.doFinalization();*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200404/3a9e75b9/attachment.html>


More information about the llvm-dev mailing list