aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-11-02 10:39:03 +0100
committerRichard Biener <rguenther@suse.de>2023-11-02 11:27:51 +0100
commitc05f748218a0d556972212d6aecfce0eb4c8a31c (patch)
treed115a9490db0fe3095264af573fed7bd3bd5c5d2 /gcc/tree-if-conv.cc
parent1ae85e6a552239b253a390db2a604b2eb0f9f536 (diff)
downloadgcc-c05f748218a0d556972212d6aecfce0eb4c8a31c.zip
gcc-c05f748218a0d556972212d6aecfce0eb4c8a31c.tar.gz
gcc-c05f748218a0d556972212d6aecfce0eb4c8a31c.tar.bz2
tree-optimization/112320 - bougs debug IL after SCCP
The following addresses wrong debug IL created by SCCP rewriting stmts to defined overflow. I addressed another inefficiency there but needed to adjust the API of rewrite_to_defined_overflow for this which is now taking a stmt iterator for in-place operation and a stmt for sequence producing because gsi_for_stmt doesn't work for stmts not in the IL. PR tree-optimization/112320 * gimple-fold.h (rewrite_to_defined_overflow): New overload for in-place operation. * gimple-fold.cc (rewrite_to_defined_overflow): Add stmt iterator argument to worker, define separate API for in-place and not in-place operation. * tree-if-conv.cc (predicate_statements): Simplify. * tree-scalar-evolution.cc (final_value_replacement_loop): Likewise. * tree-ssa-ifcombine.cc (pass_tree_ifcombine::execute): Adjust. * tree-ssa-reassoc.cc (update_range_test): Likewise. * gcc.dg/pr112320.c: New testcase.
Diffstat (limited to 'gcc/tree-if-conv.cc')
-rw-r--r--gcc/tree-if-conv.cc19
1 files changed, 1 insertions, 18 deletions
diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index 2627651..16e06d8 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -2774,24 +2774,7 @@ predicate_statements (loop_p loop)
&& TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (lhs))
&& arith_code_with_undefined_signed_overflow
(gimple_assign_rhs_code (stmt)))
- {
- gsi_remove (&gsi, true);
- gimple_seq stmts = rewrite_to_defined_overflow (stmt);
- bool first = true;
- for (gimple_stmt_iterator gsi2 = gsi_start (stmts);
- !gsi_end_p (gsi2);)
- {
- gassign *stmt2 = as_a <gassign *> (gsi_stmt (gsi2));
- gsi_remove (&gsi2, false);
- if (first)
- {
- gsi_insert_before (&gsi, stmt2, GSI_NEW_STMT);
- first = false;
- }
- else
- gsi_insert_after (&gsi, stmt2, GSI_NEW_STMT);
- }
- }
+ rewrite_to_defined_overflow (&gsi);
else if (gimple_vdef (stmt))
{
tree lhs = gimple_assign_lhs (stmt);