[Soot-list] bug in shimple optimization?

Navindra Umanee navindra at cs.mcgill.ca
Tue Jan 10 00:37:28 EST 2006


Hi Ingwar,

Ingwar Wirjawan <iwirjawan at gmail.com> wrote:
> the produced output doesn't look correct, because the function inc's
> parameter is always 0.

Indeed, you've found an edge case where optimisations prior to the
removal of the phi nodes leads to code looking like this:

    public static void foo()
    {
        int i0, i0_1, i0_2;

     label0:
(0)     i0_1 = Phi(0 #0, i0_2 #1);
        i0_2 = staticinvoke <foo: int inc(int)>(i0_1);
(1)     goto label0;
    }

because of the way phi-elimination is implemented this leads to code
looking like this:

    public static void foo()
    {
        int i0, i0_1, i0_2;

     label0:
        i0_1 = 0;
        i0_2 = staticinvoke <foo: int inc(int)>(i0_1);
        i0_1 = i0_2;
        goto label0;
    }

which leads to brokenness.  The straightforward fixes I could think of
turn out to be tricky to implement so for now I've checked in a
temporary workaround to avoid the problem.  I'll see if I can get a
more permanent fix in by end of week.

Thanks a lot for reporting this.

Cheers,
Navin.



More information about the Soot-list mailing list