<div dir="ltr">Hi,<div>I would like to run the -O1 pass sequence followed by -reg2mem from an out of tree project which uses llvm.</div><div>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?</div><div><br></div><div>Thanks,</div><div>Akash.</div><div><br></div><div><font face="monospace"><b>           PassManagerBuilder PM;<br>                PM.OptLevel = 1;<br>              PM.SizeLevel = 0;<br>             legacy::FunctionPassManager FPM(&llvm_module);<br>            legacy::PassManager MPM;<br>              PM.Inliner = createAlwaysInlinerLegacyPass();<br>         PM.DisableUnrollLoops = true;<br>         PM.populateFunctionPassManager(FPM);<br>          PM.populateModulePassManager(MPM);<br>            FPM.doInitialization();<br>               for (auto &F : llvm_module)<br>    FPM.run(F);<br>            FPM.doFinalization();<br>         MPM.run(llvm_module);<br> legacy::FunctionPassManager FPM(&llvm_module);<br>    FPM.add(createDemoteRegisterToMemoryPass());<br>  FPM.doInitialization();<br>       for (auto &F : llvm_module)<br>    FPM.run(F);<br>    FPM.doFinalization();</b></font><br></div></div>