public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/46076] [4.6 regression] constant propagation and compile-time math no longer happening versus 4.4 and 4.5
Date: Thu, 18 Nov 2010 11:53:00 -0000	[thread overview]
Message-ID: <bug-46076-4-106CakaFIu@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-46076-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46076

--- Comment #12 from rguenther at suse dot de <rguenther at suse dot de> 2010-11-18 11:31:59 UTC ---
On Wed, 17 Nov 2010, matt at use dot net wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46076
> 
> --- Comment #11 from Matt Hargett <matt at use dot net> 2010-11-17 21:37:43 UTC ---
> Given that "int foo()" and "int foo(void)" are not varargs functions, shouldn't
> GCC mainline be able to optimize this?

The types are not treated as compatible.

The following would change that:

Index: tree-ssa.c
===================================================================
--- tree-ssa.c  (revision 166900)
+++ tree-ssa.c  (working copy)
@@ -1410,6 +1410,11 @@ useless_type_conversion_p (tree outer_ty
       if (!TYPE_ARG_TYPES (outer_type))
        return true;

+      /* A conversion between unprototyped and empty argument list is ok.  
*/
+      if (TYPE_ARG_TYPES (outer_type) == void_list_node
+         && !TYPE_ARG_TYPES (inner_type))
+       return true;
+
       /* If the unqualified argument types are compatible the conversion
         is useless.  */
       if (TYPE_ARG_TYPES (outer_type) == TYPE_ARG_TYPES (inner_type))

But for example our type-generic builtins for isinf and friends also
use a NULL TYPE_ARG_TYPES list but they _are_ variadic and certainly
not compatible with isinf (void).  I'm also not sure if other languages
allow variadic functions without a first arg (the backends would
certainly handle that just fine I think).

That said - the middle-end doesn't really have a notion of "unprototyped".
That's a concept the frontend should lower (at call-sites, but that
requires some middle-end infrastructure change).

Richard.


  parent reply	other threads:[~2010-11-18 11:32 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-18 21:01 [Bug middle-end/46076] New: [4.6 regression] constant propogation " matt at use dot net
2010-10-18 21:15 ` [Bug middle-end/46076] " pinskia at gcc dot gnu.org
2010-10-18 21:36 ` matt at use dot net
2010-10-19  0:20 ` [Bug middle-end/46076] [4.6 regression] constant propagation " hjl.tools at gmail dot com
2010-10-19  3:21 ` hubicka at gcc dot gnu.org
2010-10-19  3:25 ` hubicka at gcc dot gnu.org
2010-10-19  3:33 ` hubicka at gcc dot gnu.org
2010-10-19  4:43 ` pinskia at gcc dot gnu.org
     [not found] ` <20101019044304.166D0F0158@atrey.karlin.mff.cuni.cz>
2010-10-19  5:47   ` Jan Hubicka
2010-10-19  5:47 ` hubicka at ucw dot cz
2010-10-19 10:52 ` rguenth at gcc dot gnu.org
2010-10-20  8:22 ` jakub at gcc dot gnu.org
2010-11-04 13:05 ` [Bug c/46076] " rguenth at gcc dot gnu.org
2010-11-04 13:55 ` joseph at codesourcery dot com
2010-11-17 21:39 ` matt at use dot net
2010-11-18 11:53 ` rguenther at suse dot de [this message]
2010-11-18 12:12 ` hubicka at ucw dot cz
2010-11-18 12:23 ` rguenth at gcc dot gnu.org
2011-01-04 17:40 ` jamborm at gcc dot gnu.org
2011-01-11 14:44 ` rguenth at gcc dot gnu.org
2011-01-11 15:41 ` joseph at codesourcery dot com
2011-01-11 16:27 ` rguenth at gcc dot gnu.org
2011-01-11 17:03 ` rguenth at gcc dot gnu.org
2011-01-11 17:30 ` rguenth at gcc dot gnu.org
2011-01-14 13:04 ` rguenth at gcc dot gnu.org
2011-01-14 13:08 ` rguenth at gcc dot gnu.org
2011-03-25 21:14 ` [Bug c/46076] [4.6/4.7 " jakub at gcc dot gnu.org
2011-04-12 10:44 ` rguenth at gcc dot gnu.org
2011-04-12 16:24 ` matt at use dot net
2011-04-12 17:39 ` jakub at gcc dot gnu.org
2011-04-12 18:15 ` matt at use dot net
2011-04-12 22:32 ` rguenther at suse dot de
2011-06-27 16:22 ` [Bug tree-optimization/46076] [4.6 " jakub at gcc dot gnu.org
2011-10-26 17:56 ` jakub at gcc dot gnu.org
2012-03-01 15:20 ` jakub at gcc dot gnu.org
2012-03-23 20:35 ` matt at use dot net
2012-03-26  7:06 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-46076-4-106CakaFIu@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).