From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 60B76389366C; Mon, 29 Nov 2021 08:49:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 60B76389366C MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-9333] lim: Reset flow sensitive info even for pointers [PR103192] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: a6219e8e0719b14f474b0dcaa7bde2f4e57474f9 X-Git-Newrev: 9ec84b35640aa06de5b2108deb30a3501342fbaf Message-Id: <20211129084958.60B76389366C@sourceware.org> Date: Mon, 29 Nov 2021 08:49:58 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2021 08:49:58 -0000 https://gcc.gnu.org/g:9ec84b35640aa06de5b2108deb30a3501342fbaf commit r11-9333-g9ec84b35640aa06de5b2108deb30a3501342fbaf Author: Jakub Jelinek Date: Wed Nov 17 14:18:42 2021 +0100 lim: Reset flow sensitive info even for pointers [PR103192] Since 2014 is lim clearing SSA_NAME_RANGE_INFO for integral SSA_NAMEs if moving them from conditional contexts inside of a loop into unconditional before the loop, but as the miscompilation of gimplify.c shows, we need to treat pointers the same, even for them we need to reset whether the pointer can/can't be null or the recorded pointer alignment. This fixes -FAIL: libgomp.c/../libgomp.c-c++-common/target-in-reduction-2.c (internal compiler error) -FAIL: libgomp.c/../libgomp.c-c++-common/target-in-reduction-2.c (test for excess errors) -UNRESOLVED: libgomp.c/../libgomp.c-c++-common/target-in-reduction-2.c compilation failed to produce executable -FAIL: libgomp.c++/../libgomp.c-c++-common/target-in-reduction-2.c (internal compiler error) -FAIL: libgomp.c++/../libgomp.c-c++-common/target-in-reduction-2.c (test for excess errors) -UNRESOLVED: libgomp.c++/../libgomp.c-c++-common/target-in-reduction-2.c compilation failed to produce executable -FAIL: libgomp.c++/target-in-reduction-2.C (internal compiler error) -FAIL: libgomp.c++/target-in-reduction-2.C (test for excess errors) -UNRESOLVED: libgomp.c++/target-in-reduction-2.C compilation failed to produce executable on both x86_64 and i686. 2021-11-17 Jakub Jelinek PR tree-optimization/103192 * tree-ssa-loop-im.c (move_computations_worker): Use reset_flow_sensitive_info instead of manually clearing SSA_NAME_RANGE_INFO and do it for all SSA_NAMEs, not just ones with integral types. (cherry picked from commit 077425c890927eefacb765ab5236060de9859e82) Diff: --- gcc/tree-ssa-loop-im.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 7de47edbcb3..8b1b1b2bede 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -1176,14 +1176,10 @@ move_computations_worker (basic_block bb) COND_EXPR, t, arg0, arg1); todo |= TODO_cleanup_cfg; } - if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_lhs (new_stmt))) - && (!ALWAYS_EXECUTED_IN (bb) - || (ALWAYS_EXECUTED_IN (bb) != level - && !flow_loop_nested_p (ALWAYS_EXECUTED_IN (bb), level)))) - { - tree lhs = gimple_assign_lhs (new_stmt); - SSA_NAME_RANGE_INFO (lhs) = NULL; - } + if (!ALWAYS_EXECUTED_IN (bb) + || (ALWAYS_EXECUTED_IN (bb) != level + && !flow_loop_nested_p (ALWAYS_EXECUTED_IN (bb), level))) + reset_flow_sensitive_info (gimple_assign_lhs (new_stmt)); gsi_insert_on_edge (loop_preheader_edge (level), new_stmt); remove_phi_node (&bsi, false); } @@ -1246,14 +1242,10 @@ move_computations_worker (basic_block bb) gsi_remove (&bsi, false); if (gimple_has_lhs (stmt) && TREE_CODE (gimple_get_lhs (stmt)) == SSA_NAME - && INTEGRAL_TYPE_P (TREE_TYPE (gimple_get_lhs (stmt))) && (!ALWAYS_EXECUTED_IN (bb) || !(ALWAYS_EXECUTED_IN (bb) == level || flow_loop_nested_p (ALWAYS_EXECUTED_IN (bb), level)))) - { - tree lhs = gimple_get_lhs (stmt); - SSA_NAME_RANGE_INFO (lhs) = NULL; - } + reset_flow_sensitive_info (gimple_get_lhs (stmt)); /* In case this is a stmt that is not unconditionally executed when the target loop header is executed and the stmt may invoke undefined integer or pointer overflow rewrite it to