Akash Banerjee via llvm-dev
2020-Apr-04 17:35 UTC
[llvm-dev] Running opt O1 outside of llvm
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>
Michael Kruse via llvm-dev
2020-Apr-05 19:53 UTC
[llvm-dev] Running opt O1 outside of llvm
It would be helpful to know in which cases your custom pipeline vectorizes when it should not. Note this might be dependent on target-specifics, such as PMB.LibraryInfo tjat your code below is not using. Michael Am Sa., 4. Apr. 2020 um 12:36 Uhr schrieb Akash Banerjee via llvm-dev <llvm-dev at lists.llvm.org>:> > 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(); > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Akash Banerjee via llvm-dev
2020-Apr-06 09:09 UTC
[llvm-dev] Running opt O1 outside of llvm
Hi, I have since fixed it. I was missing setting the following two flags to false. * PM.LoopVectorize = false; PM.SLPVectorize = false;* Thanks, Akash. On Mon, Apr 6, 2020 at 1:24 AM Michael Kruse <llvmdev at meinersbur.de> wrote:> It would be helpful to know in which cases your custom pipeline > vectorizes when it should not. > Note this might be dependent on target-specifics, such as > PMB.LibraryInfo tjat your code below is not using. > > Michael > > > Am Sa., 4. Apr. 2020 um 12:36 Uhr schrieb Akash Banerjee via llvm-dev > <llvm-dev at lists.llvm.org>: > > > > 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(); > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200406/d15958be/attachment.html>
Seemingly Similar Threads
- How to make LLVM go faster?
- [LLVMdev] IR Passes and TargetTransformInfo: Straw Man
- How to run InternalizePass
- Pass ordering - GVN vs. loop optimizations
- [LLVMdev] SLP vectorizer turned on in commit r190916 which says nothing about it - how to turn it off?