This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix PR64878: do not jump thread across two loop iterations


On February 4, 2015 10:20:06 PM CET, Sebastian Pop <sebpop@gmail.com> wrote:
>Hi,
>
>The attached patch stops the recursion in the detection of FSM
>jump-threads at
>loop phi nodes after having visited a loop phi node.  This avoids
>jump-threading
>two iterations forward that were possible due to a flip-flop operation
>that
>exchange the value of the switch control variable as illustrated in the
>testcase:
>
>do {
>  c = read_from_memory;
>  switch (a) {
>  case 0:
>    if (c == ' ')
>     [...]
>    else
>      a = b;   // flip-flop
>    break;
>  case 1:
>    a = 0;
>    b = 15; // this will jump-thread to 15
>    break;
>
>  case 15:
>  [...]
>  }
>} while (...);
>
>The patch has passed bootstrap and regression testing on x86_64-linux.
>Ok to commit?

But is sounds like a useful optimization?

Richard.

>Thanks,
>Sebastian



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]