On 5/28/19 7:53 AM, Jiufu Guo wrote: > Hi, > > This patch implements a new opportunity of jump threading for PR77820. > In this optimization, conditional jumps are merged with unconditional > jump. And then moving CMP result to GPR is eliminated. > > This version is based on the proposal of Richard, Jeff and Andrew, and > refined to incorporate comments. Thanks for the reviews! > > Bootstrapped and tested on powerpc64le and powerpc64be with no > regressions (one case is improved) and new testcases are added. Is this > ok for trunk? > > Example of this opportunity looks like below: > > <P0> > p0 = a CMP b > goto <X>; > > <P1> > p1 = c CMP d > goto <X>; > > <X> > # phi = PHI <p0 (P0), p1 (P1)> > if (phi != 0) goto <Y>; else goto <Z>; > > Could be transformed to: > > <P0> > p0 = a CMP b > if (p0 != 0) goto <Y>; else goto <Z>; > > <P1> > p1 = c CMP d > if (p1 != 0) goto <Y>; else goto <Z>; > > > This optimization eliminates: > 1. saving CMP result: p0 = a CMP b. > 2. additional CMP on branch: if (phi != 0). > 3. converting CMP result if there is phi = (INT_CONV) p0 if there is. Just an FYI, I threw the V2 patch into my tester overnight. THere's still several targets to build, but so far no regressions. In my spot checks of the embedded targets, they're passing the new tests -- odds are the tests are simple enough to not run into BRANCH_COST issues so we're not going to have the insane xfail lists or alternate expected outputs we've had for other tests in this space.
jeff >