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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note, fold_builtin_arith_overflow just does
      tree call = build_call_expr_internal_loc (loc, ifn, ctype, 2,
                                                arg0, arg1);
      tree tgt = save_expr (call);
and then uses tgt twice, so it is save_expr decision whether it can be
evaluated twice or needs to be done once.
And save_expr adds SAVE_EXPR only to the second case when it sees non-const
VAR_DECLs,
in the first case the arguments are TREE_READONLY and so the ifn call is as
well and so
causes tree_invariant_p_1 to return true.

Reply via email to