[Bug c++/67184] Missed optimization with C++11 final specifier

2022-05-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

--- Comment #20 from CVS Commits  ---
The releases/gcc-9 branch has been updated by Jason Merrill
:

https://gcc.gnu.org/g:30a100abe48cebcdf3d685e856850d4192f05ad9

commit r9-10161-g30a100abe48cebcdf3d685e856850d4192f05ad9
Author: Jakub Jelinek 
Date:   Fri Jul 5 22:51:44 2019 +0200

re PR c++/67184 (Missed optimization with C++11 final specifier)

PR c++/67184
PR c++/69445
* call.c (build_new_method_call_1): Remove set but not used
variable
binfo.

[Bug c++/67184] Missed optimization with C++11 final specifier

2019-07-05 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

--- Comment #19 from Jakub Jelinek  ---
Author: jakub
Date: Fri Jul  5 20:51:44 2019
New Revision: 273149

URL: https://gcc.gnu.org/viewcvs?rev=273149=gcc=rev
Log:
PR c++/67184
PR c++/69445
* call.c (build_new_method_call_1): Remove set but not used variable
binfo.

Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c

[Bug c++/67184] Missed optimization with C++11 final specifier

2019-07-05 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

Paolo Carlini  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #18 from Paolo Carlini  ---
Finally should be completely fixed without regressions.

[Bug c++/67184] Missed optimization with C++11 final specifier

2019-07-05 Thread paolo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

--- Comment #17 from paolo at gcc dot gnu.org  ---
Author: paolo
Date: Fri Jul  5 18:03:05 2019
New Revision: 273147

URL: https://gcc.gnu.org/viewcvs?rev=273147=gcc=rev
Log:
/cp
2019-07-05  Paolo Carlini  

PR c++/67184 (again)
PR c++/69445
* call.c (build_over_call): Devirtualize user-defined operators
coming from a base too.
(build_new_method_call_1): Do not devirtualize here.

/testsuite
2019-07-05  Paolo Carlini  

PR c++/67184 (again)
PR c++/69445
* g++.dg/other/final4.C: New.

Added:
trunk/gcc/testsuite/g++.dg/other/final4.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/67184] Missed optimization with C++11 final specifier

2019-06-26 Thread paolo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

--- Comment #16 from paolo at gcc dot gnu.org  ---
Author: paolo
Date: Wed Jun 26 08:51:50 2019
New Revision: 272675

URL: https://gcc.gnu.org/viewcvs?rev=272675=gcc=rev
Log:
2019-06-26  Paolo Carlini  

PR c++/67184
PR c++/69445
* g++.dg/other/final3.C: New.
* g++.dg/other/final5.C: Likewise.

Added:
trunk/gcc/testsuite/g++.dg/other/final3.C
trunk/gcc/testsuite/g++.dg/other/final5.C
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug c++/67184] Missed optimization with C++11 final specifier

2019-06-25 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

--- Comment #15 from Paolo Carlini  ---
With Jason's r272656 remains to be handled what I had as other/final4.C.
final.3.C and final5.C are fine, I'm probably going to add those two to the
testsuite.

[Bug c++/67184] Missed optimization with C++11 final specifier

2019-06-23 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

Paolo Carlini  changed:

   What|Removed |Added

 Status|REOPENED|ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |paolo.carlini at oracle 
dot com

--- Comment #14 from Paolo Carlini  ---
Let's look a bit more into this (with Jason' help)

[Bug c++/67184] Missed optimization with C++11 final specifier

2019-06-21 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

Paolo Carlini  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---
   Assignee|paolo.carlini at oracle dot com|unassigned at gcc dot 
gnu.org

--- Comment #13 from Paolo Carlini  ---
Unfortunately I have to re-open this: the fix, as-is, caused c++/90909.

[Bug c++/67184] Missed optimization with C++11 final specifier

2019-06-21 Thread paolo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

--- Comment #12 from paolo at gcc dot gnu.org  ---
Author: paolo
Date: Fri Jun 21 20:47:40 2019
New Revision: 272574

URL: https://gcc.gnu.org/viewcvs?rev=272574=gcc=rev
Log:
/cp
2019-06-21  Paolo Carlini  

PR c++/90909
Revert:
2019-05-21  Paolo Carlini  

PR c++/67184
PR c++/69445
* call.c (build_over_call): Devirtualize when the final overrider
comes from the base.

/testsuite
2019-06-21  Paolo Carlini  

PR c++/90909
Revert:
2019-05-21  Paolo Carlini  

PR c++/67184
PR c++/69445
* g++.dg/other/final3.C: New.
* g++.dg/other/final4.C: Likewise.
* g++.dg/other/final5.C: Likewise.

* g++.dg/other/final6.C: New.

Removed:
trunk/gcc/testsuite/g++.dg/other/final3.C
trunk/gcc/testsuite/g++.dg/other/final4.C
trunk/gcc/testsuite/g++.dg/other/final5.C

[Bug c++/67184] Missed optimization with C++11 final specifier

2019-06-21 Thread paolo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

--- Comment #11 from paolo at gcc dot gnu.org  ---
Author: paolo
Date: Fri Jun 21 20:46:51 2019
New Revision: 272573

URL: https://gcc.gnu.org/viewcvs?rev=272573=gcc=rev
Log:
/cp
2019-06-21  Paolo Carlini  

PR c++/90909
Revert:
2019-05-21  Paolo Carlini  

PR c++/67184
PR c++/69445
* call.c (build_over_call): Devirtualize when the final overrider
comes from the base.

/testsuite
2019-06-21  Paolo Carlini  

PR c++/90909
Revert:
2019-05-21  Paolo Carlini  

PR c++/67184
PR c++/69445
* g++.dg/other/final3.C: New.
* g++.dg/other/final4.C: Likewise.
* g++.dg/other/final5.C: Likewise.

* g++.dg/other/final6.C: New.

Added:
trunk/gcc/testsuite/g++.dg/other/final6.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/67184] Missed optimization with C++11 final specifier

2019-05-21 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

Paolo Carlini  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |10.0

--- Comment #10 from Paolo Carlini  ---
Fixed.

[Bug c++/67184] Missed optimization with C++11 final specifier

2019-05-21 Thread paolo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

--- Comment #8 from paolo at gcc dot gnu.org  ---
Author: paolo
Date: Tue May 21 22:26:10 2019
New Revision: 271490

URL: https://gcc.gnu.org/viewcvs?rev=271490=gcc=rev
Log:
/cp
2019-05-21  Paolo Carlini  

PR c++/67184
PR c++/69445
* call.c (build_over_call): Devirtualize when the final overrider
comes from the base.

/testsuite
2019-05-21  Paolo Carlini  

PR c++/67184
PR c++/69445
* g++.dg/other/final3.C: New.
* g++.dg/other/final4.C: Likewise.
* g++.dg/other/final5.C: Likewise.

Added:
trunk/gcc/testsuite/g++.dg/other/final3.C
trunk/gcc/testsuite/g++.dg/other/final4.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/67184] Missed optimization with C++11 final specifier

2019-05-21 Thread paolo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

--- Comment #9 from paolo at gcc dot gnu.org  ---
Author: paolo
Date: Tue May 21 22:26:42 2019
New Revision: 271491

URL: https://gcc.gnu.org/viewcvs?rev=271491=gcc=rev
Log:
/cp
2019-05-21  Paolo Carlini  

PR c++/67184
PR c++/69445
* call.c (build_over_call): Devirtualize when the final overrider
comes from the base.

/testsuite
2019-05-21  Paolo Carlini  

PR c++/67184
PR c++/69445
* g++.dg/other/final3.C: New.
* g++.dg/other/final4.C: Likewise.
* g++.dg/other/final5.C: Likewise.

Added:
trunk/gcc/testsuite/g++.dg/other/final5.C

[Bug c++/67184] Missed optimization with C++11 final specifier

2019-05-16 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

Paolo Carlini  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |paolo.carlini at oracle 
dot com

--- Comment #7 from Paolo Carlini  ---
Seems doable.

[Bug c++/67184] Missed optimization with C++11 final specifier

2019-04-08 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

Jonathan Wakely  changed:

   What|Removed |Added

   Last reconfirmed|2016-01-29 00:00:00 |2019-4-8

--- Comment #6 from Jonathan Wakely  ---
(In reply to Giovanni Deretta from comment #0)
> I would expect call(wV&) to generate the same code as call(oV&).

Except of course it should be a direct call to V::foo(), not oV::foo().

As I showed in Bug 69445 the devirtualization does happen when the final
overrider is in the derived class:

struct Base {
  virtual void foo() const {};
  virtual void bar() const {}
};

struct C final : Base {
  void foo() const { }
};

void func(const C & c) {
  c.foo();  // optimized away
  c.bar();
}

It doesn't happen when the final overrider comes from the base.

[Bug c++/67184] Missed optimization with C++11 final specifier

2016-01-29 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

Jonathan Wakely  changed:

   What|Removed |Added

 CC||redi at gcc dot gnu.org

--- Comment #5 from Jonathan Wakely  ---
*** Bug 69445 has been marked as a duplicate of this bug. ***

[Bug c++/67184] Missed optimization with C++11 final specifier

2016-01-29 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

Jonathan Wakely  changed:

   What|Removed |Added

 Status|RESOLVED|NEW
   Last reconfirmed|2015-08-11 00:00:00 |2016-1-29
 Resolution|DUPLICATE   |---

--- Comment #4 from Jonathan Wakely  ---
Not a dup, this is a different case.

[Bug c++/67184] Missed optimization with C++11 final specifier

2015-08-12 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

Markus Trippelsdorf trippels at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #3 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
(In reply to Paolo Carlini from comment #2)
 Related to c++/65143.

Yes, lets close this one.

*** This bug has been marked as a duplicate of bug 65143 ***


[Bug c++/67184] Missed optimization with C++11 final specifier

2015-08-12 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

Paolo Carlini paolo.carlini at oracle dot com changed:

   What|Removed |Added

 CC|gpderetta at gmail dot com |

--- Comment #2 from Paolo Carlini paolo.carlini at oracle dot com ---
Related to c++/65143.


[Bug c++/67184] Missed optimization with C++11 final specifier

2015-08-11 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184

Markus Trippelsdorf trippels at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-08-11
 CC||hubicka at gcc dot gnu.org,
   ||trippels at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
Confirmed. Adding CC.