https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125776
--- Comment #4 from Drea Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Drea Pinski from comment #3)
> It could be the use of FOR_EACH_IMM_USE_FAST. I have to check if thst could
> have a debug stmt or not. If so then I need to skip it.
Yes this patch fixes it:
```
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index 9c253883f07..ce34e40c1f3 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -305,6 +305,8 @@ is_factor_profitable (gimple *def_stmt, basic_block merge,
const gimple_match_op
FOR_EACH_IMM_USE_FAST (use_p, iter, arg)
{
gimple *use_stmt = USE_STMT (use_p);
+ if (is_gimple_debug (use_stmt))
+ continue;
basic_block use_bb = gimple_bb (use_stmt);
if (dominated_by_p (CDI_DOMINATORS, merge, use_bb))
{
```
Will push later today.