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 to calling copy_bbs, to create my new path and keep
the various ssa and cfg information up to date, either by modifying it or by
blowing it away and regenerating it, I am not worried about compilation speed
at this point so if regenerating all the SSA/cfg data is easiest, I am happy
to do that.
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 what needs to happen when you copy a block for this kind of optimization. Feel free to ignore the implementation which has to be fairly efficient when there's a large number of edges to update.

Jeff

Reply via email to