https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122985

            Bug ID: 122985
           Summary: tree-switch-conversion should move over to using
                    gimple_convert/gimple_build instead of
                    force_gimple_operand_gsi
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: easyhack, internal-improvement
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Currently we do:
```
   uidx = make_ssa_name (utype);
   sub = fold_build2_loc (loc, MINUS_EXPR, utype,
                         fold_convert_loc (loc, utype, m_index_expr),
                         fold_convert_loc (loc, utype, m_range_min));
   sub = force_gimple_operand_gsi (&gsi, sub,
                                  false, NULL, true, GSI_SAME_STMT);
   stmt = gimple_build_assign (uidx, sub);
```

But this all can/should just be:
```
  tmp1 = gimple_convert (&gsi, true, GSI_SAME_STMT, UNKNOWN_LOCATION, utype,
m_index_expr);
  tmp2 = gimple_convert (&gsi, true, GSI_SAME_STMT, UNKNOWN_LOCATION, utype,
m_range_min);
  uidx = gimple_build (&gsi, true, GSI_SAME_STMT, UNKNOWN_LOCATION, MINUS_EXPR,
tmp1, tmp2);
```

And many more like this in tree-switch-conversion.cc

Reply via email to