Treat ADDR_EXPR and CONSTRUCTOR as GIMPLE/GENERIC magically
The following allows to match ADDR_EXPR for both the invariant &a.b case as well as the &p->d case in a separate definition transparently. This also allows to remove the hack we employ for CONSTRUCTOR which we handle for example with (match vec_same_elem_p CONSTRUCTOR@0 (if (TREE_CODE (@0) == SSA_NAME && uniform_vector_p (gimple_assign_rhs1 (SSA_NAME_DEF_STMT (@0)))))) Note CONSTUCTORs always appear as separate definition in GIMPLE, but I continue to play safe and ADDR_EXPRs are now matched in both places where previously ADDR_EXPR@0 would have missed the &p->x case. This is a prerequesite for the PR89317 fix. * genmatch.cc (dt_node::gen_kids): Handle ADDR_EXPR in both the GENERIC and GIMPLE op position. (dt_simplify::gen): Capture both GENERIC and GIMPLE op position for ADDR_EXPR and CONSTRUCTOR. * match.pd: Simplify CONSTRUCTOR leaf handling. * gcc.dg/tree-ssa/forwprop-3.c: Adjust. * g++.dg/tree-ssa/pr31146-2.C: Likewise.
Showing
- gcc/genmatch.cc 25 additions, 5 deletionsgcc/genmatch.cc
- gcc/match.pd 4 additions, 8 deletionsgcc/match.pd
- gcc/testsuite/g++.dg/tree-ssa/pr31146-2.C 1 addition, 1 deletiongcc/testsuite/g++.dg/tree-ssa/pr31146-2.C
- gcc/testsuite/gcc.dg/tree-ssa/forwprop-3.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/tree-ssa/forwprop-3.c
Loading
Please register or sign in to comment