[llvm-dev] Running opt O1 outside of llvm

Michael Kruse via llvm-dev llvm-dev at lists.llvm.org
Sun Apr 5 12:53:25 PDT 2020


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


More information about the llvm-dev mailing list