"Splitting" live values

Suppose I have in my CFG (among others) two basic blocks A and B, with an edge from A to B. I need to do the following:

• get the set S of live values across that edge
• map each of them to another value (S->S’)
• replace - in B and its successors - all the uses of values in S with the mapped values (S’)
Does LLVM provide an easy way to do this (because I can’t seem to be able to find it)? If not, do you have any suggestions about how to do it?

I forgot to add that it doesn’t have to be exactely the set of live values: it can also be an overapproximation, i.e. S might contain also values that are not live anymore

From the fact that nobody is replying I guess there’s no easy way to do what I asked.
Can you just confirm then that the following is a meaningful way to do it?

• D_b ← set of dominators of BB b

• S_b ← set containing b and its successors (optional)

• VD_b ← set of the values defined in D_b

• VS_b ← set of the values with uses in S_b (optional)

• LV_b ← VD_b ∩ VS_b, i.e. the live values (optional, otherwise LV_b = VD_b)

• create the value mapping LV_b → LV’_b

• apply the mapping to the uses in VS_b
the points marked (optional) are needed only if we don’t want an overapproximation of the set of live values. To keep things simple, let’s assume that b has a single predecessor.
Is this correct? Any flaws?

Hi,

From the fact that nobody is replying I guess there's no easy way to do
Can you just confirm then that the following is a meaningful way to do it?

* D_b <- set of dominators of BB b
* S_b <- set containing b and its successors (optional)
* VD_b <- set of the values defined in D_b
* VS_b <- set of the values with uses in S_b (optional)
* LV_b <- VD_b ∩ VS_b, i.e. the live values (optional, otherwise
LV_b = VD_b)
* create the value mapping LV_b -> LV'_b
* apply the mapping to the uses in VS_b

I think your approach is correct, but there are more optimized approaches to compute sets of Live values.
I suggest you have a look at the Phd thesis of Benoit Boissinot, chapter 3, that you can find here:
http://bboissin.appspot.com/thesis.html

Hope this helps,

Julien