[Bug c/91526] Unnecessary SSE and other instructions generated when compiling in C mode (vs. C++ mode)
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Aug 23 07:56:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91526
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Target| |x86_64-*-*, i?86-*-*
Status|UNCONFIRMED |NEW
Last reconfirmed| |2019-08-23
CC| |jakub at gcc dot gnu.org,
| |mpolacek at gcc dot gnu.org
Component|target |c
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think I've seen duplicates about this issue where C/C++ differ in the IL
presented to the middle-end for the aggregate return stmt which in the
end causes us to not elide an aggregate copy. Usually SRA deals with
this but it has a hard job with heuristics and arrays...
The C++ FE does
;; Function Vec multiply(const Vec*, const Vec*) (null)
;; enabled by -tree-original
{
struct Vec result [value-expr: <retval>];
^^^
while the C FE does
;; Function multiply (null)
;; enabled by -tree-original
{
struct Vec result;
so the C++ FE already elides the return copy by placing 'result' in the
return slot while the C FE doesn't do this.
Let's make this a C enhancement request rather than a missed optimization
during GIMPLE optimizations (which there are dups for already).
Marek - any chance the C FE could do sth like this? Maybe we can also
do this during gimplification, we'd have to see what constraints the C++
FE has for performing this.
More information about the Gcc-bugs
mailing list