openmp: Add testing checks (whether lhs appears in operands at all) to more trees
authorJakub Jelinek <jakub@redhat.com>
Tue, 14 Sep 2021 08:31:42 +0000 (10:31 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 14 Sep 2021 08:36:41 +0000 (10:36 +0200)
commit3f89d5ebcca8ea8c363db39cd3946db12b11adcc
treedfee36022ad2f1cc90f8e61bb81ad4c3801cd640
parentf3922acfdfff1e426bd1238cf09eeb84332464c9
openmp: Add testing checks (whether lhs appears in operands at all) to more trees

This patch adds testing checks (goa_stabilize_expr with NULL pre_p) for more
tree codes, so that we don't gimplify their operands individually unless lhs
appears in them.  Also, so that we don't have exponential compile time complexity
with the added checks, I've added a depth computation, we don't expect lhs
to be found in depth 8 or above as all the atomic forms must have x expression
in specific places in the expressions.

2021-09-14  Jakub Jelinek  <jakub@redhat.com>

* gimplify.c (goa_stabilize_expr): Add depth argument, propagate
it to recursive calls, for depth above 7 just gimplify or return.
Perform a test even for MODIFY_EXPR, ADDR_EXPR, COMPOUND_EXPR with
__builtin_clear_padding and TARGET_EXPR.
(gimplify_omp_atomic): Adjust goa_stabilize_expr callers.
gcc/gimplify.c