search for: populatemodulepassmanager

Displaying 20 results from an estimated 85 matches for "populatemodulepassmanager".

2015 Dec 20
3
How to run InternalizePass
...so far: legacy::FunctionPassManager FPM(&M); legacy::PassManager MPM; PassManagerBuilder Builder; Builder.OptLevel = 3; Builder.PrepareForLTO = true; Builder.VerifyInput = true; Builder.VerifyOutput = true; Builder.populateFunctionPassManager(FPM); Builder.populateModulePassManager(MPM); FPM.doInitialization(); for (Function &F : M) FPM.run(F); FPM.doFinalization(); MPM.run(M); -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151220/14cd4588/attachment.html>
2020 Apr 04
2
Running opt O1 outside of llvm
...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.doFinal...
2018 Jul 10
2
Programmatically Toggle Specific LLVM Optimizations
...our > list of passes> | llc > (not tested, so don't expect to work straight out of the box) > > This is not strictly the same as optimizing using clang (pass options > are missing), so there will be performance differences. You could > instead customize PassManagerBuilder::populateModulePassManager() and > PassManagerBuilder::populateFunctionPassManager(). > > Michael
2017 Apr 10
3
Relationship between clang, opt and llc
...executable 2. clang -O0 -c -emit-llvm -o source.bc opt -O3 source.bc -o source.bc llc -O3 -filetype=obj source.bc -o source.o ... clang a.o b.o c.o ... -o executable I took a look at the source code of the clang tool and the opt tool, they both seem to use the PassManagerBuilder::populateModulePassManager() and PassManagerBuilder::populateFunctionPassManager() functions to add passes to their optimization pipeline; and for the backend, the clang and llc both use the addPassesToEmitFile() function to generate object code. So presumably the above two approaches to generating optimized executable file...
2011 Nov 15
1
[LLVMdev] add pass to O2. use as "clang -O2 .."
...ng looppass for my project, opt --help can see it. I want clang to use my pass too, so that I don't have to compile to IR, opt, and then llc to binary manually. Now I am trying to add my pass to O2 by mimicking LICM pass. I add a line "MPM.add(createMyPass());" in PassManagerBuilder::populateModulePassManager, and got assertion fail "void llvm::PMTopLevelManager::schedulePass(llvm::Pass*): Assertion `PI && "Expected required passes to be initialized"' failed." I can't figure out how to solve this? thanks for any inputs. yuanfang -------------- next part -----------...
2013 Nov 07
1
[LLVMdev] SLP vectorizer turned on in commit r190916 which says nothing about it - how to turn it off?
...) +++ tools/opt/opt.cpp (revision 190916) @@ -462,6 +462,7 @@ DisableLoopUnrolling : OptLevel == 0; Builder.LoopVectorize = OptLevel > 1 && SizeLevel < 2; + Builder.SLPVectorize = true; Builder.populateFunctionPassManager(FPM); Builder.populateModulePassManager(MPM); I think that should not be there? There should at least be a way to turn the SLP optimizer off? It breaks things on our architecture(TCE) which I'm now porting to use llvm 3.4
2015 Nov 06
2
Repeated application of optimization passes
Within the LLVM pass manager infrastructure, suppose we have two transformation passes, pass A makes some improvements, then pass B does likewise, but this creates opportunities for pass A to create further improvements (e.g. suppose B was function inlining) so it's desirable to run A again. How does the LLVM pass manager currently deal with this? -------------- next part -------------- An
2013 Oct 07
0
[LLVMdev] Pass sequence
...re a way to specify this order by modifying the llvm code? > I am new to the PassManager and PassRegistry and I am not sure if I should use them, therefore every detailed procedure will be appreciated. In answer to the last part of your question, maybe you're looking for PassManagerBuilder::populateModulePassManager. -Andy -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131006/9028e1d9/attachment.html>
2017 Mar 31
2
How to write the same things as `opt` command in C++ API
...llvm::LLVMContext context; /// @brief module std::unique_ptr<llvm::Module> module = llvm::make_unique<llvm::Module>("my module", context); llvm::PassManagerBuilder pm_builder; llvm::legacy::PassManager pm; pm_builder.Inliner = llvm::createFunctionInliningPass(); pm_builder.populateModulePassManager(pm); /// @brief Create function type (void) => i32 llvm::FunctionType *commonfuncType = llvm::FunctionType::get(llvm::Type::getInt32Ty(context), {}, false); /// @brief Create a function (define i32 a()) llvm::Function *aFun = llvm::Function::Create(commonfuncType, llvm::Fu...
2013 Feb 27
1
[LLVMdev] Compilation problem when addind a library
Hi ! Here is the situation. I created a pass in lib/Transforms/Obfuscation. I added a createFlattening() in IPO.h and in my code to be able to use it in PassManagerBuilder.cpp (lib/Transforms/IPO) in the method PopulateModulePassManager() so I can add my pass to standard passes. It all works if I add all my files in the lib/Transforms/IPO directory. But I want to keep them away in the lib/Transforms/Obfuscation directory. This is my Makefile: LEVEL = ../../.. LIBRARYNAME = LLVMobfuscation LOADABLE_MODULE = 1 BUILD_ARCHIVE = 1...
2013 Dec 01
0
[LLVMdev] Disabling certain optimizations at -O1?
...pragma optimize and ask GCC to support both). Same thing with optimization levels (#pragma optimize 3), we can embed the knowledge of the flags and optimization level, so then when we pass them to the passes, we already know what we want to run without having to change in many places. In the end, populateModulePassManager() should be about building the flags table and (almost) unconditionally adding all passes with the respective flags. cheers, --renato
2015 Sep 20
2
How to invoke simplifycfg from code
...;t created near the end, it exists at the start and never goes away. On Sun, Sep 20, 2015 at 1:36 PM, Hal Finkel <hfinkel at anl.gov> wrote: > Hi Russell, > > Can you run your IR though opt with -O3 and -print-after-all and see when > the block becomes empty? PassManagerBuilder::populateModulePassManager has, > fairly near the end: > > MPM.add(createCFGSimplificationPass()); > > but, other things do run afterward. Maybe we need another one of these > closer to the end? > > One other thing to realize is that an empty block like this might not > actually turn up in any ge...
2018 Jun 01
2
Programmatically Toggle Specific LLVM Optimizations
Hi everyone! First time poster here. Apologies if I am breaking some rules and please let me know so I will not break it again! I am a summer research student at the Computer Science Department at the University of Toronto and I am working on benchmarking LLVM optimizations. I tried looking for it online but was not able to find a programmatic way to toggle specific LLVM optimizations. For
2015 Apr 21
2
[LLVMdev] Using an alias analysis pass
...ion` method is called, but `alias` never is, and neither is `getAdjustedAnalysisPointer`. I use a `PassManagerBuilder` object to populate a `legacy::PassManager`, which I then run on my module. I tried two different approaches to insert my AA pass. The first was to add the AA pass before calling `populateModulePassManager`, since the AA passes are the first ones to be added, and this would put mine first. This didn’t help: `runOnFunction` was called, but `alias` never was. Additionally, now that I moved from `INITIALIZE_AG_PASS` to `RegisterPass<T>`, trying this causes an assert to trigger with the message &qu...
2014 Sep 17
7
[LLVMdev] Postponing more passes in LTO
Looking at the existing flow of passes for LTO, it appears that most all passes are run on a per file basis, before the call to the gold linker. I'm looking to get people's feedback on whether there would be an advantage to waiting to run a number of these passes until the linking stage. For example, I believe I saw a post a little while back about postponing vectorization until the
2013 Oct 06
3
[LLVMdev] Pass sequence
Hi all, I wrote 2 passes and I want to make run llvm run the passes in this order: -mem2reg -load=…/mypass1.dylib -mypass1 -load=…/mypass2.dylib -mypass2 -O1 -O2 -O3 I know I can do this by manually passing them as an argument to opt. Is there any way to force this sequence directly from clang? I am asking this because I am trying to compile a program and I can specify in the ./configure
2015 Sep 20
2
How to invoke simplifycfg from code
...gt; > On Sun, Sep 20, 2015 at 1:36 PM, Hal Finkel < hfinkel at anl.gov > > > wrote: > > > > > > Hi Russell, > > > > Can you run your IR though opt with -O3 and -print-after-all and see > > when the block becomes empty? > > PassManagerBuilder::populateModulePassManager has, fairly near the > > end: > > > > MPM.add(createCFGSimplificationPass()); > > > > but, other things do run afterward. Maybe we need another one of > > these closer to the end? > > > > One other thing to realize is that an empty block like this mig...
2017 Apr 11
2
Relationship between clang, opt and llc
...emit-llvm -o source.bc > opt -O3 source.bc -o source.bc > llc -O3 -filetype=obj source.bc -o source.o > ... > clang a.o b.o c.o ... -o executable > > I took a look at the source code of the clang tool and the opt tool, they both seem to use the PassManagerBuilder::populateModulePassManager() and PassManagerBuilder::populateFunctionPassManager() functions to add passes to their optimization pipeline; and for the backend, the clang and llc both use the addPassesToEmitFile() function to generate object code. > > So presumably the above two approaches to generating optimized execu...
2012 Feb 13
1
[LLVMdev] Vectorization: Next Steps
...optimization as running clang with the target you want enabled though. We already have this problem with -loop-reduce though. > LoopStrengthReduction is currently created in TargetPassConfig::addIRPasses (CodeGen/Passes.cpp). Currently the vectorization pass is created in PassManagerBuilder::populateModulePassManager (which is used by opt). Are you suggesting that I move the vectorization pass creation into CodeGen? Or are you saying that TLI will sometimes be available to the pass, as it is now, when called from a full-compilation driver (like clang)? Or are you suggesting that I propose some object like TLI t...
2013 Dec 01
3
[LLVMdev] Disabling certain optimizations at -O1?
Could we move this setting to function attributes? We already have OptimizeForSize / MinSize there, but not the other opt levels. We also have OptimizeNone, which seems to be completely unused. This would let us support __attribute__((optimize())) in the future, which is currently ignored. Another example would be an LTO link of objects compiled with different optimization settings. I'm not