https://gcc.gnu.org/g:acd2ca1e28128d9d0d41683d6039f437c02d793f
commit r15-1198-gacd2ca1e28128d9d0d41683d6039f437c02d793f Author: Pan Li <pan2...@intel.com> Date: Tue Jun 11 21:39:43 2024 +0800 Widening-Mul: Take gsi after_labels instead of start_bb for gcall insertion We inserted the gcall of .SAT_ADD before the gsi_start_bb for avoiding the ssa def after use ICE issue. Unfortunately, there will be the potential ICE when the first stmt is label. We cannot insert the gcall before the label. Thus, we take gsi_after_labels to locate the 'really' stmt that the gcall will insert before. The existing test cases pr115387-1.c and pr115387-2.c cover this change. The below test suites are passed for this patch. * The rv64gcv fully regression test with newlib. * The x86 regression test. * The x86 bootstrap test. gcc/ChangeLog: * tree-ssa-math-opts.cc (math_opts_dom_walker::after_dom_children): Leverage gsi_after_labels instead of gsi_start_bb to skip the leading labels of bb. Signed-off-by: Pan Li <pan2...@intel.com> Diff: --- gcc/tree-ssa-math-opts.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc index fbb8e0ea3067..c09e90064439 100644 --- a/gcc/tree-ssa-math-opts.cc +++ b/gcc/tree-ssa-math-opts.cc @@ -6102,7 +6102,7 @@ math_opts_dom_walker::after_dom_children (basic_block bb) for (gphi_iterator psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi)) { - gimple_stmt_iterator gsi = gsi_start_bb (bb); + gimple_stmt_iterator gsi = gsi_after_labels (bb); match_unsigned_saturation_add (&gsi, psi.phi ()); }