From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7201 invoked by alias); 15 Dec 2010 16:07:46 -0000 Received: (qmail 7193 invoked by uid 22791); 15 Dec 2010 16:07:45 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 15 Dec 2010 16:07:41 +0000 From: "jamborm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/45791] Missed devirtualization X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jamborm at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Wed, 15 Dec 2010 16:07:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-12/txt/msg01774.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45791 --- Comment #14 from Martin Jambor 2010-12-15 16:07:31 UTC --- (In reply to comment #9) > OK, main() code seems to optimize out that is an imrovement. Is it optimized > away with your patch pre-IPA too? Yes. Just before IPA, in fact. > > Derived() is also devirtualizable: > It could be done intraprocedurally if, unlike for automatically allocated decls, we considered all calls as potentially changing the dynamic type in unknown ways while doing the dynamic type change detection. This then however becomes essentially the same thing as devirtualization based on the constant folding, perhaps only more complicated. It could be optimized by IPA-CP if we can confirm that all callers are automatically allocated (or that we generally have them under control). This should be relatively easy, I will have a look at that. Mainly because we may be able to widen scope of objects under our control later.