On 06/01/2016 04:46 AM, kugan wrote:
Hi All, Factoring out CONVERT_EXPR introduced a regression for (PR66726). I had to revert my previous patch due to some regressions. This is a much simplified version compared to the one I reverted. There is a test-case (pr46309.c) in the test-suite which is valid for targets that has branch cost greater than 1. This patch makes optimize_range_tests understand the factored out COND_EXPR. i.e., Updated the final_range_test_p to look for the new pattern. Changed the maybe_optimize_range_tests (which does the inter basic block range test optimization) accordingly. With the patch m68k-linux-gnu-gcc -O2 -S pr46309.c -fdump-tree-reassoc-details grep -e "Optimizing range tests" -e into pr46309.c.*.reassoc1pr46309.c.114t.reassoc1:Optimizing range tests a_6(D) -[1, 1] and -[2, 2] and -[3, 3] and -[4, 4] pr46309.c.114t.reassoc1: into (unsigned int) a_6(D) + 4294967295 > 3 pr46309.c.114t.reassoc1: into _10 = _13; pr46309.c.114t.reassoc1:Optimizing range tests a_6(D) -[1, 1] and -[2, 2] and -[3, 3] and -[4, 4] pr46309.c.114t.reassoc1: into (unsigned int) a_6(D) + 4294967295 > 3 pr46309.c.114t.reassoc1: into _10 = _13; pr46309.c.114t.reassoc1:Optimizing range tests a_4(D) -[1, 1] and -[3, 3] pr46309.c.114t.reassoc1: into (a_4(D) & -3) != 1 pr46309.c.114t.reassoc1: into _6 = _8; pr46309.c.114t.reassoc1:Optimizing range tests a_4(D) -[1, 1] and -[2, 2] pr46309.c.114t.reassoc1: into (unsigned int) a_4(D) + 4294967295 > 1 pr46309.c.114t.reassoc1: into _6 = _9; pr46309.c.114t.reassoc1:Optimizing range tests a_5(D) -[0, 31] and -[64, 95] pr46309.c.114t.reassoc1: into (a_5(D) & 4294967231) > 31 pr46309.c.114t.reassoc1: into _7 = _9; pr46309.c.114t.reassoc1:Optimizing range tests a_9(D) -[0, 31] and -[64, 95] pr46309.c.114t.reassoc1: into (a_9(D) & 4294967231) > 31 pr46309.c.114t.reassoc1:Optimizing range tests a_9(D) -[128, 159] and -[192, 223] pr46309.c.114t.reassoc1: into (a_9(D) & 4294967231) + 4294967168 > 31 pr46309.c.114t.reassoc1: into _13 = _18 | _15; pr46309.c.116t.reassoc1:Optimizing range tests a_2(D) -[1, 1] and -[2, 2] and -[3, 3] and -[4, 4] pr46309.c.116t.reassoc1: into (unsigned int) a_2(D) + 4294967295 > 3 pr46309.c.116t.reassoc1:Optimizing range tests a_2(D) -[1, 1] and -[2, 2] and -[3, 3] and -[4, 4] pr46309.c.116t.reassoc1: into (unsigned int) a_2(D) + 4294967295 > 3 pr46309.c.116t.reassoc1:Optimizing range tests a_3(D) -[0, 31] and -[64, 95] pr46309.c.116t.reassoc1: into (a_3(D) & 4294967231) > 31 pr46309.c.116t.reassoc1:Optimizing range tests a_5(D) -[0, 31] and -[64, 95] pr46309.c.116t.reassoc1: into (a_5(D) & 4294967231) > 31 pr46309.c.116t.reassoc1:Optimizing range tests a_5(D) -[128, 159] and -[192, 223] pr46309.c.116t.reassoc1: into (a_5(D) & 4294967231) + 4294967168 > 31 Bootstrapped and regression testing on x86-64-linux-gnu and ppc64le-linux-gnu doesn't have any new regressions. Also did regression testing arm variants which has branch cost greater than 1 Is this OK for trunk. Thanks, Kugan gcc/ChangeLog: 2016-06-01 Kugan Vivekanandarajah <kug...@linaro.org> PR middle-end/66726 * tree-ssa-reassoc.c (optimize_vec_cond_expr): Handle tcc_compare stmt whose result is used in PHI (final_range_test_p): Likewise. (maybe_optimize_range_tests): Likewise.
OK for the trunk. Thanks for your patience, Jeff