[LLVMdev] Restoring SSA form

Vladimir Prus ghost at cs.msu.su
Wed Nov 24 00:11:10 PST 2004


On Tuesday 23 November 2004 20:36, Vikram S. Adve wrote:

> I don't know why you said that mem2reg is too specialized to work for
> your problem, but at least for the example you gave you can make it
> work.  If you converted the above code to the following:
>
>  i = 0;
>      if (i > 0) {
>         tmp = i;
>   i = change_value_range(tmp);
>   tmp = i;
>         foo(tmp);
>      }
>
> and then replace i with an alloca'd location, 

Seems like a good idea!

> mem2reg should restore 
> SSA just fine (the tmp is needed so that the alloca pointer is not
> passed to change_value_range() or foo())

Thanks, I'll try this.

- Volodya




More information about the llvm-dev mailing list