[Soot-list] LazyCodeMotion issue

Arie Zilberstein arie.zilberstein at gmail.com
Sat May 1 11:56:44 EDT 2010


Hi,

There has been no response yet on the topic of LazyCodeMotion.
Does anybody know if LazyCodeMotion is in working condition? I suspect that
this analysis might be broken.

Best,
Arie

On Sat, Apr 24, 2010 at 5:58 PM, Arie Zilberstein <
arie.zilberstein at gmail.com> wrote:

> Hi,
>
> I want to utilize the LazyCodeMotion analysis to remove some redundancies
> from code.
> I crafted an example code which I thought was amenable to optimization:
>
>  private static void testPre(int a, int b) {
> int sum = 0;
> int c = a + b;
>  int d = a + b;
> sum += c;
> sum += d;
>  System.out.println(sum);
> }
>
> I expected LazyCodeMotion to assign the redundant computation (a+b) to a
> temporary variable, and replace all following computations by this
> temporary. However, while a temporary is indeed created, the replacement
> does not happen.
>
> Debugging through the code I found the following:
> 1. The code section titled "insert the computations" does its job
> correctly: the expression a+b is indeed assigned to a new temporary $lcm0
> variable.
> 2. The code section titled "replace old computations by the helper-vars"
> does not replace c or d with an assignment to $lcm0.
> 3. The reason for that is the condition "if (!latestSet.contains(rhs) &&
> notIsolatedSet.contains(rhs))". The left side is false because, latestSet
> contains the a+b expression. Therefore no replacement is done.
>
> My question is -- is there a bug in LazyCodeMotion or is it a
> misunderstanding on my part?
>
> Best,
> Arie
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20100501/d2195020/attachment.html 


More information about the Soot-list mailing list