-
- Downloads
PHIOPT: factor out unary operations instead of just conversions
After using factor_out_conditional_conversion with diamond bb, we should be able do use it also for all normal unary gimple and not just conversions. This allows to optimize PR 59424 for an example. This is also a start to optimize PR 64700 and a few others. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. An example of this is: ``` static inline unsigned long long g(int t) { unsigned t1 = t; return t1; } static int abs1(int a) { if (a < 0) a = -a; return a; } unsigned long long f(int c, int d, int e) { unsigned long long t; if (d > e) t = g(abs1(d)); else t = g(abs1(e)); return t; } ``` Which should be optimized to: _9 = MAX_EXPR <d_5(D), e_6(D)>; _4 = ABS_EXPR <_9>; t_3 = (long long unsigned intD.16) _4; gcc/ChangeLog: * tree-ssa-phiopt.cc (factor_out_conditional_conversion): Rename to ... (factor_out_conditional_operation): This and add support for all unary operations. (pass_phiopt::execute): Update call to factor_out_conditional_conversion to call factor_out_conditional_operation instead. PR tree-optimization/109424 PR tree-optimization/59424 gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/abs-2.c: Update tree scan for details change in wording. * gcc.dg/tree-ssa/minmax-17.c: Likewise. * gcc.dg/tree-ssa/pr103771.c: Likewise. * gcc.dg/tree-ssa/minmax-18.c: New test. * gcc.dg/tree-ssa/minmax-19.c: New test.
Showing
- gcc/testsuite/gcc.dg/tree-ssa/abs-2.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/tree-ssa/abs-2.c
- gcc/testsuite/gcc.dg/tree-ssa/minmax-17.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/tree-ssa/minmax-17.c
- gcc/testsuite/gcc.dg/tree-ssa/minmax-18.c 27 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/minmax-18.c
- gcc/testsuite/gcc.dg/tree-ssa/minmax-19.c 10 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/minmax-19.c
- gcc/testsuite/gcc.dg/tree-ssa/pr103771.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/tree-ssa/pr103771.c
- gcc/tree-ssa-phiopt.cc 31 additions, 25 deletionsgcc/tree-ssa-phiopt.cc
Loading
Please register or sign in to comment