/* Otherwise, if RESULT_DECL is DECL_BY_REFERENCE, it will take
the function_result_decl's assignment. Since it's a pointer,
we can short-circuit a number of the tests below, and we must
- duplicat e them because we don't have the
- function_result_decl to test. */
+ duplicate them because we don't have the function_result_decl
+ to test. */
if (!targetm.calls.allocate_stack_slots_for_args ())
return true;
/* We don't set DECL_IGNORED_P for the function_result_decl. */
if (optimize)
return true;
+ if (cfun->tail_call_marked)
+ return true;
/* We don't set DECL_REGISTER for the function_result_decl. */
return false;
}
--- /dev/null
+/* PR middle-end/98082 */
+/* Reported by Martin Liska <marxin@gcc.gnu.org> */
+
+/* { dg-do compile { target c++20 } } */
+/* { dg-options "-fipa-icf" } */
+
+class GoodIter {
+public:
+ GoodIter();
+ GoodIter(GoodIter &);
+};
+
+GoodIter operator-(int, GoodIter) { return GoodIter(); }
+GoodIter operator+(int, GoodIter) { return GoodIter(); }