mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-26 16:51:01 +08:00
loop-manip: Avoid -fcompare-debug issues in create_iv [PR94285]
The following testcase FAILs with -fcompare-debug. The problem is that create_iv behaves differently when inserting after into an empty bb (in that case sets location to goto_locus), or when inserting before gsi_end_p (i.e. at the end of bb; in that case it will not set location, otherwise it will set it to the location of next stmt). This isn't -fcompare-debug friendly, because if inserting after and the bb contains only debug stmts, then the location will not be set with -g and will be with -g0, or when inserting before, the location might either be set from the following debug stmt rather than some non-debug stmt after that, or might not be set with -g0 if it is to be inserted at the end of bb, while with -g would be set to location of debug stmt. 2020-03-24 Jakub Jelinek <jakub@redhat.com> PR debug/94285 * tree-ssa-loop-manip.c (create_iv): If after, set stmt location to e->goto_locus even if gsi_bb (*incr_pos) contains only debug stmts. If not after and at *incr_pos is a debug stmt, set stmt location to location of next non-debug stmt after it if any. * gfortran.dg/pr94285.f90: New test.
This commit is contained in:
parent
a5a9400a84
commit
565ab7efbd
@ -1,5 +1,11 @@
|
||||
2020-03-24 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR debug/94285
|
||||
* tree-ssa-loop-manip.c (create_iv): If after, set stmt location to
|
||||
e->goto_locus even if gsi_bb (*incr_pos) contains only debug stmts.
|
||||
If not after and at *incr_pos is a debug stmt, set stmt location to
|
||||
location of next non-debug stmt after it if any.
|
||||
|
||||
PR debug/94283
|
||||
* tree-if-conv.c (ifcvt_local_dce): For gimple debug stmts, just set
|
||||
GF_PLF_2, but don't add them to worklist. Don't add an assigment to
|
||||
|
@ -1,5 +1,8 @@
|
||||
2020-03-24 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR debug/94285
|
||||
* gfortran.dg/pr94285.f90: New test.
|
||||
|
||||
PR debug/94283
|
||||
* gcc.target/i386/pr94283.c: New test.
|
||||
|
||||
|
5
gcc/testsuite/gfortran.dg/pr94285.f90
Normal file
5
gcc/testsuite/gfortran.dg/pr94285.f90
Normal file
@ -0,0 +1,5 @@
|
||||
! PR debug/94285
|
||||
! { dg-do compile }
|
||||
! { dg-options "-Os -fno-tree-dominator-opts -fno-tree-vrp -fcompare-debug" }
|
||||
|
||||
include 'array_constructor_40.f90'
|
@ -129,7 +129,10 @@ create_iv (tree base, tree step, tree var, class loop *loop,
|
||||
immediately after a statement whose location is known. */
|
||||
if (after)
|
||||
{
|
||||
if (gsi_end_p (*incr_pos))
|
||||
if (gsi_end_p (*incr_pos)
|
||||
|| (is_gimple_debug (gsi_stmt (*incr_pos))
|
||||
&& gsi_bb (*incr_pos)
|
||||
&& gsi_end_p (gsi_last_nondebug_bb (gsi_bb (*incr_pos)))))
|
||||
{
|
||||
edge e = single_succ_edge (gsi_bb (*incr_pos));
|
||||
gimple_set_location (stmt, e->goto_locus);
|
||||
@ -138,8 +141,11 @@ create_iv (tree base, tree step, tree var, class loop *loop,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gsi_end_p (*incr_pos))
|
||||
gimple_set_location (stmt, gimple_location (gsi_stmt (*incr_pos)));
|
||||
gimple_stmt_iterator gsi = *incr_pos;
|
||||
if (!gsi_end_p (gsi) && is_gimple_debug (gsi_stmt (gsi)))
|
||||
gsi_next_nondebug (&gsi);
|
||||
if (!gsi_end_p (gsi))
|
||||
gimple_set_location (stmt, gimple_location (gsi_stmt (gsi)));
|
||||
gsi_insert_before (incr_pos, stmt, GSI_NEW_STMT);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user