search for: mergereturn

Displaying 20 results from an estimated 36 matches for "mergereturn".

2010 Mar 31
0
[LLVMdev] CFG entry and exit blocks
...convert your .dot file into a graph file, but I'll make some comments anyway. :) First, LLVM does not guarantee that a function has a single exit block. Multiple basic blocks can have a return instruction as their terminator instruction. There is a pass (Unify Function Exit nodes i.e., -mergereturn <http://llvm.org/docs/Passes.html#mergereturn>) that transform a function to have only 1 return instruction. Now, I haven't looked at LLVM's new exception handling facilities recently, but there used to be an unwind instruction that would unwind the stack to the nearest dynamicall...
2004 Aug 16
1
[LLVMdev] Optimization Levels - Need The Details
...t; > > For clarity, the -O options are currently defined as: > > -O0 - synonym for -O1 > > -O1 - options to speed up compilation, not execution > > I'm not sure what would be the best options, but at least -simplifycfg > -mem2reg should be included. I was thinking -mergereturn and -instcombine might be okay too. I think Vikram suggested -instcombine. I added -mergereturn but I'm not sure that's right. Your thoughts? > > -O2 - simple/fast module/function optimizations > > Probably a subset of what gccas runs. My problem is that I don't know the...
2010 May 09
0
[LLVMdev] Remove identical or redundant basic blocks?
Eugene Toder wrote: > Would it make sense to have a similar pass that operates on llvm main IR? > The unify exit return node (-mergereturn?) pass should take care of the first example. The -simplifycfg option might take care of the second example. Both work on LLVM IR. -- John T. > On Sat, May 8, 2010 at 5:15 PM, Dale Johannesen <dalej at apple.com> wrote: > >> The branch folding pass does this, but it operat...
2010 Mar 31
2
[LLVMdev] CFG entry and exit blocks
Hi, I'm confused about the entry and exit blocks of an LLVM CFG. I understand that every CFG has one and only one entry block, and this is confirmed by the existence of the getEntryBlock function in the Function class. But what about exit (a.k.a. return) blocks? At first I assumed that LLVM CFGs have one and only one exit block, too, but the following code is a counter-example:
2010 May 08
2
[LLVMdev] Remove identical or redundant basic blocks?
Would it make sense to have a similar pass that operates on llvm main IR? On Sat, May 8, 2010 at 5:15 PM, Dale Johannesen <dalej at apple.com> wrote: > The branch folding pass does this, but it operates later, on the > target-dependent form in llc. > > On May 8, 2010, at 8:48 AM, Heinz Riener wrote: > >> Dear all, >> >> after optimizing a small LLVM example
2010 May 09
1
[LLVMdev] Remove identical or redundant basic blocks?
...l of these blocks disappear in later target-dependent optimizations. I have not thought about that since eliminating these blocks requires no target-dependent information. However, I guess it is not worth eliminating them earlier. John, I tried your advice and executed opt (after -O3) again with -mergereturn and -simplifycfg: The -mergereturn pass introduces another basic block, called UnifiedReturnBlock, and replaces ret instructions with jumps to UnifiedReturnBlock. So, it does not eliminates any block but it creates one. (I think its task is to merge the ret instructions (and not the blocks).) The...
2010 Jul 24
2
[LLVMdev] Controlling the order of a FunctionPass
...nager must > be explicitly told (via the PassManager.add() method) to run that pass > first. If you're running your pass via the opt tool, then it means that > the user must manually specify the prerequisite passes in the correct > order (e.g., opt -load<your pass filename> -mergereturn -<your pass > name>). If you're building a separate program that schedules the > passes, then it needs to run the prerequisite passes first. What?? Sure it does. See all the passes which require BreakCritEdges or LCSSA for examples. > > See the sc tool in the SAFECode sour...
2013 Nov 15
2
[LLVMdev] dominator, post-dominator and memory leak
Hi Henrique, I have tried using -mergereturn and inserting a free into the predecessors of dominance frontier of malloc block and it caused double free. It is possible for multiple free's to be inserted on the path from malloc to an exit. For example, in the following CFG: BB10 (malloc) / \...
2013 Nov 13
0
[LLVMdev] dominator, post-dominator and memory leak
...crossed my mind a few minutes later. : ) If you're interested, PRE.cpp existed last at r25315. It calculates the "availability frontier" which is probably what you're looking for. I suggest, however, that you try coming up with another solution instead. You might consider using -mergereturn. H. On Wed, Nov 13, 2013 at 2:13 AM, Bin Tzeng <bintzeng at gmail.com> wrote: > Hi Henrique, > Thanks for the quick reply! > > On Tue, Nov 12, 2013 at 9:13 PM, Henrique Santos < > henrique.nazare.santos at gmail.com> wrote: > >> PRE normally uses a latest pla...
2013 Nov 15
0
[LLVMdev] dominator, post-dominator and memory leak
...ope this reasoning make sense. : ) Also, you might also have to treat the special case in which the block where the malloc() is placed dominates the return block. H. On Fri, Nov 15, 2013 at 2:29 AM, Bin Tzeng <bintzeng at gmail.com> wrote: > Hi Henrique, > > I have tried using -mergereturn and inserting a free into the predecessors > of dominance frontier of malloc block and it caused double free. It is > possible for multiple free's to be inserted on the path from malloc to an > exit. For example, in the following CFG: > > BB10 (malloc) >...
2017 Mar 02
5
Structurizing multi-exit regions
Hi, I'm trying to solve a problem from StructurizeCFG not actually handling regions with multiple exits. Sample IR attached. StructurizeCFG doesn't touch this function, exiting early on the isTopLevelRegion check. SIAnnotateControlFlow then gets confused and ends up inserting an if into one of the blocks, and the matching end.cf into one of the return/unreachable blocks. The input to
2010 Mar 31
2
[LLVMdev] CFG entry and exit blocks
...is to happen? I've tried feeding C++ code with multiple return statements to LLVM, but it always spits out a CFG with a single return block. All of the blocks for the return statements simply branch to this final return block. > There is a pass (Unify Function Exit nodes i.e., > -mergereturn <http://llvm.org/docs/Passes.html#mergereturn>) that > transform a function to have only 1 return instruction. That sounds like a good approach, except that this pass does not appear to produce a CFG with exactly one return block, but rather one or zero return blocks. The distinction...
2013 Nov 13
3
[LLVMdev] dominator, post-dominator and memory leak
Hi Henrique, Thanks for the quick reply! On Tue, Nov 12, 2013 at 9:13 PM, Henrique Santos < henrique.nazare.santos at gmail.com> wrote: > PRE normally uses a latest placement algorithm to do something of the sort. > I don't know about GVN/PRE, but older version of PRE might have it. > Just placing the calls to free at the predecessors (dominated by BB12) of > the dominance
2010 Jul 23
0
[LLVMdev] Controlling the order of a FunctionPass
...then the PassManager must be explicitly told (via the PassManager.add() method) to run that pass first. If you're running your pass via the opt tool, then it means that the user must manually specify the prerequisite passes in the correct order (e.g., opt -load <your pass filename> -mergereturn -<your pass name>). If you're building a separate program that schedules the passes, then it needs to run the prerequisite passes first. See the sc tool in the SAFECode source code for an example. 2) For prerequisite *analysis* passes (like LoopInfo), your ModulePass can declare the...
2010 Aug 05
1
[LLVMdev] a problem when using postDominatorTree
Wenbin Zhang wrote: > I'll try the trunk, as well as check my code again. If indeed it's not > fixed, I'll try to post a triggering case here. > Thanks for the advice~ > Did you run the -mergereturn pass (it might also be called UnifyExitNodes in the source code)? This is the pass that ensures that each function has exactly one basic block that returns control to the caller. It's possible that PostDominator doesn't handle functions with multiple exits (if someone knows whether it does...
2010 Jul 22
3
[LLVMdev] Controlling the order of a FunctionPass
On Jul 22, 2010, at 2:05 PM, John Criswell wrote: > If you write your pass as a ModulePass, then you can iterate over the > functions in any order that you want. I had considered that, but my FunctionPass depends on other passes processing the functions first: void MyPass::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<UnifyFunctionExitNodes>();
2010 Aug 05
3
[LLVMdev] a problem when using postDominatorTree
On 08/05/2010 06:46 AM, Wenbin Zhang wrote: > Hi all, > I'm using postDominatorTree to do some program analysis. My code works > well for small tests, but when I run it on real applications, the > following error occurs: > /Inorder PostDominator Tree: DFSNumbers invalid: 0 slow queries. > [1] <<exit node>> {0,21} > [2] %bb1 {1,2} > [2] %bb {3,4} > [2]
2013 Nov 13
2
[LLVMdev] dominator, post-dominator and memory leak
...inutes later. : ) > > If you're interested, PRE.cpp existed last at r25315. It calculates the > "availability frontier" which is probably what you're looking for. > I suggest, however, that you try coming up with another solution instead. > You might consider using -mergereturn. > > H. > > > On Wed, Nov 13, 2013 at 2:13 AM, Bin Tzeng <bintzeng at gmail.com> wrote: > >> Hi Henrique, >> Thanks for the quick reply! >> >> On Tue, Nov 12, 2013 at 9:13 PM, Henrique Santos < >> henrique.nazare.santos at gmail.com> wrot...
2004 Aug 15
0
[LLVMdev] Optimization Levels - Need The Details
On Sat, 14 Aug 2004, Reid Spencer wrote: > I'm at the point in developing llvmc (Compiler Driver) where I need to > get the details on the specific optimization arguments that the -O > family of options should (by default) issue to "opt". I'm soliciting > your feedback on this so I can start testing optimization. Hopefully you > can provide it by early this coming
2013 Nov 13
0
[LLVMdev] dominator, post-dominator and memory leak
...> > > If you're interested, PRE.cpp existed last at r25315. It calculates > the "availability frontier" which is probably what you're looking > for. > > I suggest, however, that you try coming up with another solution > instead. You might consider using -mergereturn. > > > > > > H. > > > > > > On Wed, Nov 13, 2013 at 2:13 AM, Bin Tzeng < bintzeng at gmail.com > > wrote: > > > > > Hi Henrique, > Thanks for the quick reply! > > > > > On Tue, Nov 12, 2013 at 9:13 PM, H...