On 5/15/25 10:36 AM, Ville Voutilainen wrote:
This is a follow-up to the earlier patch that adds std::to_underlying to the
set of stdlib functions that are folded. We don't seem to need to handle
the same-type case specially, the folding will just do the right thing.
Also fix up the mistake of not tweaking the cmdline switch doc in the earlier
patch.
Tested Linux-PPC64, ok for trunk?
Further simplify the stdlib inline folding
gcc/cp/ChangeLog:
* cp-gimplify.cc (cp_fold): Remove the nop handling, let the
folding just fold it all.
gcc/ChangeLog:
* doc/invoke.texi: Add to_underlying to -ffold-simple-inlines.
@@ -3347,8 +3347,6 @@ cp_fold (tree x, fold_flags_t flags)
|| id_equal (DECL_NAME (callee), "as_const")))
{
r = CALL_EXPR_ARG (x, 0);
- if (!same_type_p (TREE_TYPE (x), TREE_TYPE (r)))
- r = build_nop (TREE_TYPE (x), r);
This is removing the conversion entirely; I'm rather surprised it didn't
break anything. I thought you were thinking to make the build_nop
unconditional.
The doc fix is OK.
Jason