Re: How do I modify SSA and copy basic blocks?

2013-04-26 Thread Richard Biener
On Thu, Apr 25, 2013 at 8:28 PM, Steve Ellcey wrote: > On Thu, 2013-04-25 at 09:53 +0200, Richard Biener wrote: > >> We have gimple_duplicate_sese_region for this. It may be not perfect though. >> Eventually it should be changed to handle SEME regions as well and all >> loop copying / versioning

Re: How do I modify SSA and copy basic blocks?

2013-04-25 Thread Steve Ellcey
On Thu, 2013-04-25 at 09:53 +0200, Richard Biener wrote: > We have gimple_duplicate_sese_region for this. It may be not perfect though. > Eventually it should be changed to handle SEME regions as well and all > loop copying / versioning code should use it as well (though I don't think > any of th

Re: How do I modify SSA and copy basic blocks?

2013-04-25 Thread Steve Ellcey
On Thu, 2013-04-25 at 09:53 +0200, Richard Biener wrote: > > Interesting you should mention this; one of the things I really want to get > > back to is a more generic mechanism to copy block regions. > > We have gimple_duplicate_sese_region for this. It may be not perfect though. > Eventually it

Re: How do I modify SSA and copy basic blocks?

2013-04-25 Thread Zdenek Dvorak
Hi, > On Tue, 2013-04-23 at 15:24 -0600, Jeff Law wrote: > > > Well, you have to copy the blocks, adjust the edges and rewrite the SSA > > graph. I'd use duplicate_block to help. > > > > You really want to look at tree-ssa-threadupdate.c. There's a nice big > > block comment which gives the

Re: How do I modify SSA and copy basic blocks?

2013-04-25 Thread Richard Biener
On Thu, Apr 25, 2013 at 5:03 AM, Jeff Law wrote: > On 04/24/2013 04:54 PM, Steve Ellcey wrote: >> >> >> I am still having trouble with this and with figuring out how to >> straighten out my PHI nodes. I have decided to try a slightly different >> tack and see if I could create a routine that woul

Re: How do I modify SSA and copy basic blocks?

2013-04-24 Thread Jeff Law
On 04/24/2013 04:54 PM, Steve Ellcey wrote: I am still having trouble with this and with figuring out how to straighten out my PHI nodes. I have decided to try a slightly different tack and see if I could create a routine that would do a generic basic block copy, handling all the needed bookkee

Re: How do I modify SSA and copy basic blocks?

2013-04-24 Thread Steve Ellcey
On Wed, 2013-04-24 at 15:54 -0700, Steve Ellcey wrote: > > /* Copy the basic block that is the destination block of orig_edge, then >modify/replace the edge in orig_edge->src basic block with a new edge >that goes to the new block. Fix up any PHI nodes that may need to be >updated.

Re: How do I modify SSA and copy basic blocks?

2013-04-24 Thread Steve Ellcey
On Wed, 2013-04-24 at 14:31 -0600, Jeff Law wrote: > On 04/24/2013 11:38 AM, Steve Ellcey wrote: > Just do duplicate_block (B, NULL, NULL) > > Then I'd remove the switch statement and the outgoing edges from B' > except the edge B'->C. > > Then I'd fixup the PHIs in C. That's update_destinatio

Re: How do I modify SSA and copy basic blocks?

2013-04-24 Thread Jeff Law
On 04/24/2013 11:38 AM, Steve Ellcey wrote: I think I understand the high level work, it is mapping that hight level description to the low level calls that I am having trouble with. Lets say I have basic blocks A, B, and C, and edges from A to B and B to C. There may also be other edges leadin

Re: How do I modify SSA and copy basic blocks?

2013-04-24 Thread Steve Ellcey
On Tue, 2013-04-23 at 15:24 -0600, Jeff Law wrote: > Well, you have to copy the blocks, adjust the edges and rewrite the SSA > graph. I'd use duplicate_block to help. > > You really want to look at tree-ssa-threadupdate.c. There's a nice big > block comment which gives the high level view of

Re: How do I modify SSA and copy basic blocks?

2013-04-23 Thread Jeff Law
On 04/23/2013 02:43 PM, Steve Ellcey wrote: I think I have code that finds the path that I am interested in, but when I try to use copy_bbs to copy the basic blocks in order to create my new path, I get segfaults. I was wondering if anyone could help me understand what I need to do, in addition

How do I modify SSA and copy basic blocks?

2013-04-23 Thread Steve Ellcey
I decided to take a crack at the coremark optimization (PR 54742) for switch statements. Since I couldn't figure out the existing jump threading optimization enough to extend it properly, I decided to try a plugin optimization pass just for this case and see if I could get that to work. The basic