Hi all,

I modified the control flow graph of a loop by redirecting the latch edge
to a new loop header BB like below:

    before:
           BB1(latch BB)  ------> BB2(header BB) ------> BB3(loop body BB)
------> BB1
                                             BB2(old header)   BB2 dominate
BB3
     after:                                             |
           BB1(latch) ------> BB3(loop body BB as new header) ------> BB1

so I need to create some new PHI nodes for the new header(BB3)
corresponding to PHI nodes in the old header. Suppose I have a PHI node in
old header BB like:
                      dst_45 = PHI <dst_30(9), dst_23(D)(15)>
and I create a new PHI node in new header BB like:
                      dst_151 = PHI <dst_45(19), dst_30(9)>
Now, I need to replace all of uses of dst_45 with dst_151 for the whole
CFG, my question is:

1. Is there any function to do the replacement in GCC?  update_ssa function
didn't work.
2. or I need to iterate over all basic blocks in CFG to do replacing?

Reply via email to