Richard, First of all, your proposal to move type sinking to the end of function does not work since we handle each statement in function and we want that 1st type folding of X & C will not happen. Note that we have the following sequence of gimple before forwprop1:
x.0_10 = (signed char) x_8; _11 = x.0_10 & 1; _12 = (signed char) y_9; _13 = _12 & 1; _14 = _11 ^ _13; I also added comment to my fix and create new test for it. I also checked that this test is passed with patched compiler only. So Change Log was also modified: ChangeLog 2013-02-20 Yuri Rumyantsev <ysrum...@gmail.com> PR tree-optimization/56175 * tree-ssa-forwprop.c (simplify_bitwise_binary): Avoid type sinking at 1st forwprop pass to recognize (A & C) ^ (B & C) -> (A ^ B) & C for short integer types. * gcc.dg/pr56175.c: New test. 2013/2/20 Richard Biener <richard.guent...@gmail.com>: > On Wed, Feb 20, 2013 at 1:00 PM, Yuri Rumyantsev <ysrum...@gmail.com> wrote: >> Hi All, >> >> This patch is aimed to recognize (A & C) ^ (B & C) -> (A ^ B) & C >> pattern in simpify_bitwise_binary for short integer types. >> The fix is very simple - we simply turn off short type sinking at the >> first pass of forward propagation allows to get >> +10% speedup for important benchmark Coremark 1.0 at x86 Atom and >> +5-7% for other x86 platforms too. >> Bootstrapping and regression testing were successful on x86-64. >> >> Is it Ok for trunk? > > It definitely needs a comment before the checks. > > Also I think it simply shows that the code is placed at the wrong spot. > Simply moving it down in simplify_bitwise_binary to be done the very last > should get both of the effects done. > > Can you rework the patch according to that? > > You also miss a testcase, we should make sure to not regress again here. > > Thanks, > Richard. > >> ChangeLog. >> >> 2013-02-20 Yuri Rumyantsev <ysrum...@gmail.com> >> >> PR tree-optimization/56175 >> * tree-ssa-forwprop.c (simplify_bitwise_binary) : Avoid type sinking >> at 1st forwprop pass to recognize (A & C) ^ (B & C) -> (A ^ B) & C >> for short integer types.
56175.diff
Description: Binary data