[Bug tree-optimization/54742] Switch elimination in FSM loop

joey.ye at arm dot com gcc-bugzilla@gcc.gnu.org
Fri Mar 8 03:56:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54742

--- Comment #8 from Joey Ye <joey.ye at arm dot com> 2013-03-08 03:56:38 UTC ---
// A none loop case shows how minor changes impacts current jump thread
behavior

int foo(int state, int check)
{
    switch (state) {
        case 0:
            state = 1;
            zoo_0();
            break;
        case 1:
        default:
            state = 0;
            zoo_1();
            break;
    }

    if (!check) return 0;
    //check++;  // Uncomment it results will disable jump thread
    //check=foo();  // Uncomment it results will disable jump thread

    switch (state) {
        case 0:
            bar_0();
            break;
        case 1:
        default:
            bar_1();
            break;
    }
    return check;
}



More information about the Gcc-bugs mailing list