]> git.ipfire.org Git - thirdparty/gcc.git/commit
Treat ADDR_EXPR and CONSTRUCTOR as GIMPLE/GENERIC magically
authorRichard Biener <rguenther@suse.de>
Sun, 11 Dec 2022 11:32:49 +0000 (12:32 +0100)
committerRichard Biener <rguenther@suse.de>
Sun, 11 Dec 2022 13:45:30 +0000 (14:45 +0100)
commit26295a069fd312a8be4a6cd96643117383145cc0
tree1a9da2a4bef72422499665558a335bb6b9fd3791
parentf8d136e50e6f82cba793483d910a2b2643108508
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.
gcc/genmatch.cc
gcc/match.pd
gcc/testsuite/g++.dg/tree-ssa/pr31146-2.C
gcc/testsuite/gcc.dg/tree-ssa/forwprop-3.c