[Bug c++/88118] GCC keeps unnecessary calls to new

2021-12-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88118

--- Comment #8 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #7)
> Fixed in GCC 10 by r10-2105-gcb50701ec2c7a (I found a slight missed
> optimization but I will file that as a seperate issue).

The slight missed optimization is due to main being marked as called only once
so it is not really a missed one so I am not going to file it.

[Bug c++/88118] GCC keeps unnecessary calls to new

2021-12-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88118

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED
  Known to fail||8.1.0, 9.1.0
   Target Milestone|--- |10.0

--- Comment #7 from Andrew Pinski  ---
Fixed in GCC 10 by r10-2105-gcb50701ec2c7a (I found a slight missed
optimization but I will file that as a seperate issue).

[Bug c++/88118] GCC keeps unnecessary calls to new

2021-12-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88118

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement
   See Also||https://bugs.llvm.org/show_
   ||bug.cgi?id=39731

[Bug c++/88118] GCC keeps unnecessary calls to new

2018-11-21 Thread tiagomacarios at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88118

--- Comment #6 from Tiago Macarios  ---
Related clang bug: https://bugs.llvm.org/show_bug.cgi?id=39731

[Bug c++/88118] GCC keeps unnecessary calls to new

2018-11-21 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88118

--- Comment #5 from Marc Glisse  ---
"An implementation is allowed to omit a call to a replaceable global allocation
function" (not any operator new) so I am not sure DECL_IS_OPERATOR_NEW is the
right test.

[Bug c++/88118] GCC keeps unnecessary calls to new

2018-11-21 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88118

--- Comment #4 from Jonathan Wakely  ---
(In reply to Richard Biener from comment #3)
> If clang removes the new calls then DECL_IS_OPERATOR_NEW may not have
> side-effects that need to be preserved. (hopefully)

Since C++14 the C++ standard explicitly allows the new expressions to avoid
calling allocation functions, even though they might have side effects. See
https://wg21.link/n3664 and the clarifications made by DR 1786 as shown in
https://wg21.link/n3914 (search for 1786).

[Bug c++/88118] GCC keeps unnecessary calls to new

2018-11-21 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88118

Richard Biener  changed:

   What|Removed |Added

   Keywords||missed-optimization
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-11-21
 Ever confirmed|0   |1

--- Comment #3 from Richard Biener  ---
Yeah, we have code special-casing BUILT_IN_MALLOC and friends but not
DECL_IS_OPERATOR_NEW.  And we do not have DECL_IS_OPERATOR_DELETE.

If clang removes the new calls then DECL_IS_OPERATOR_NEW may not have
side-effects that need to be preserved. (hopefully)

Look in tree-ssa-dce.c for BUILT_IN_MALLOC handling and amed it with
DECL_IS_OPERATOR_NEW.  Profit!

[Bug c++/88118] GCC keeps unnecessary calls to new

2018-11-20 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88118

Marc Glisse  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=58483

--- Comment #2 from Marc Glisse  ---
Or PR 87732 or PR 78104 or ...

[Bug c++/88118] GCC keeps unnecessary calls to new

2018-11-20 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88118

Andrew Pinski  changed:

   What|Removed |Added

 Depends on||19831

--- Comment #1 from Andrew Pinski  ---
Related to bug 19831.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19831
[Bug 19831] Missing DSE/malloc/free optimization