]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Further simplify the stdlib inline folding
authorVille Voutilainen <ville.voutilainen@gmail.com>
Thu, 15 May 2025 13:26:52 +0000 (16:26 +0300)
committerVille Voutilainen <ville.voutilainen@gmail.com>
Fri, 16 May 2025 14:58:33 +0000 (17:58 +0300)
gcc/cp/ChangeLog:
* cp-gimplify.cc (cp_fold): Do the conversion unconditionally, even for same-type cases.

gcc/ChangeLog:
* doc/invoke.texi: Add to_underlying to -ffold-simple-inlines.

gcc/cp/cp-gimplify.cc
gcc/doc/invoke.texi

index eab55504b050dd3fef7b57b2c017bf762e440af7..f7bd453bc5eb3662b228ca988a89349a733fd964 100644 (file)
@@ -3347,8 +3347,7 @@ 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);
+           r = build_nop (TREE_TYPE (x), r);
            x = cp_fold (r, flags);
            break;
          }
index ee7180110e19445fde3c2da677a88c3f2f06656c..83c63ce6ae5315d1b26b32096a5c4a80a3a90cba 100644 (file)
@@ -3348,7 +3348,8 @@ aliases, the default is @option{-fno-extern-tls-init}.
 @item -ffold-simple-inlines
 @itemx -fno-fold-simple-inlines
 Permit the C++ frontend to fold calls to @code{std::move}, @code{std::forward},
-@code{std::addressof} and @code{std::as_const}.  In contrast to inlining, this
+@code{std::addressof}, @code{std::to_underlying}
+and @code{std::as_const}.  In contrast to inlining, this
 means no debug information will be generated for such calls.  Since these
 functions are rarely interesting to debug, this flag is enabled by default
 unless @option{-fno-inline} is active.