aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-manip.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-07-05 08:28:36 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2019-07-05 08:28:36 +0000
commitffdc40a90faec54d29af76b994c52790685a8e58 (patch)
treedfcc27a711785d7ec9afaeb709fc96338e4bb044 /gcc/tree-ssa-loop-manip.c
parent8d21ff6025652fa67085d94d5101cd699c57cf0b (diff)
downloadgcc-ffdc40a90faec54d29af76b994c52790685a8e58.zip
gcc-ffdc40a90faec54d29af76b994c52790685a8e58.tar.gz
gcc-ffdc40a90faec54d29af76b994c52790685a8e58.tar.bz2
tree-cfg.c (gimple_make_forwarder_block): Propagate location info on phi nodes if possible.
* tree-cfg.c (gimple_make_forwarder_block): Propagate location info on phi nodes if possible. * tree-scalar-evolution.c (final_value_replacement_loop): Propagate location info on the newly created statement. * tree-ssa-loop-manip.c (create_iv): Propagate location info on the newly created increment if needed. From-SVN: r273131
Diffstat (limited to 'gcc/tree-ssa-loop-manip.c')
-rw-r--r--gcc/tree-ssa-loop-manip.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 7db4f09..f072418 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -126,10 +126,22 @@ create_iv (tree base, tree step, tree var, struct loop *loop,
gsi_insert_seq_on_edge_immediate (pe, stmts);
stmt = gimple_build_assign (va, incr_op, vb, step);
+ /* Prevent the increment from inheriting a bogus location if it is not put
+ immediately after a statement whose location is known. */
if (after)
- gsi_insert_after (incr_pos, stmt, GSI_NEW_STMT);
+ {
+ if (gsi_end_p (*incr_pos))
+ {
+ edge e = single_succ_edge (gsi_bb (*incr_pos));
+ gimple_set_location (stmt, e->goto_locus);
+ }
+ gsi_insert_after (incr_pos, stmt, GSI_NEW_STMT);
+ }
else
- gsi_insert_before (incr_pos, stmt, GSI_NEW_STMT);
+ {
+ gimple_set_location (stmt, gimple_location (gsi_stmt (*incr_pos)));
+ gsi_insert_before (incr_pos, stmt, GSI_NEW_STMT);
+ }
initial = force_gimple_operand (base, &stmts, true, var);
if (stmts)