Re: Eliminating SSA variables

Ali Al-Shabibi <ali@olympe.ch>
31 Jul 2005 00:48:54 -0400

          From comp.compilers

Related articles
Eliminating SSA variables richard@imagecraft.com (Richard M.) (2005-07-28)
Re: Eliminating SSA variables jsinger@cs.man.ac.uk (Jeremy Singer) (2005-07-31)
Re: Eliminating SSA variables drizzle76@gmail.com (dz) (2005-07-31)
Re: Eliminating SSA variables ali@olympe.ch (Ali Al-Shabibi) (2005-07-31)
| List of all articles for this month |
From: Ali Al-Shabibi <ali@olympe.ch>
Newsgroups: comp.compilers
Date: 31 Jul 2005 00:48:54 -0400
Organization: EPFL
References: 05-07-114
Keywords: SSA, optimize
Posted-Date: 31 Jul 2005 00:48:54 EDT

Hi,


Basically, what you want to do is avoid the copy of i2 to i1 on the last
iteration, to do this you must identify the critical edge and split it.
In your case the critiacal edge is the your goto top. So in your SSA
form you will move the assignment of i2 to i1 into another node and only
jump to that node in the case where the if (i2 < 10) is true.


Hope this is clear enough. This problem is called the lost-copy problem
and you can find very good resources about this on the web.


Enjoy,


--
-- Ali Al-Shabibi (Aka Al-Hacker)


Richard M. wrote:
> Given a source program fragment like this:
> int i;
> for (i = 0; i < 10; i++)
> ;
>
> After SSA transformation and back, we have
>
> i = 0;
> i1 = i;
> top:
> i2 = i1+1;
> i1 = i2;
> if (i2 < 10) goto top;
> ...
>
> The problem now is that there are 2 variables inside the loop, i1 and i2
> with overlapping lifetimes, thus using more registers and causing extra
> register moves at code generation time. Is there something we can do to
> address this problem?


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.