From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9154 invoked by alias); 24 Feb 2014 14:22:15 -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 Received: (qmail 9092 invoked by uid 48); 24 Feb 2014 14:22:06 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/60315] [4.8/4.9 Regression] template constructor switch optimization Date: Mon, 24 Feb 2014 14:22:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: compile-time-hog X-Bugzilla-Severity: minor X-Bugzilla-Who: rguenth 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: 4.8.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg02445.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60315 --- Comment #7 from Richard Biener --- Note that we seem to fail to update BB predicates for switch stmts. size:0.000000, time:0.000000, predicate:(true) size:3.000000, time:2.000000, predicate:(not inlined) size:2.000000, time:2.000000, predicate:(op1 changed) size:8.000000, time:3.200000, predicate:(op1 changed) && (op1 != 2) I cannot interpret the size 2 case (what is "op1 changed"?), but in that case we actually shrink compared to not inlining. As && op1 != 2 makes it more restrictive it's odd that that increases the metrics. As inliner I would inline all the (op1 changed) cases, thus in the above case op1 == 2. We seem to inline fully until hitting the case where only recursive edges are left. Even for only two switch cases we inline 5(!) calls into Test. Ah, the switch isn't handled by the predicates because BB 3 predicate:(op1 != 1) s.1_4 = (int) s_2(D); freq:0.80 size: 0 time: 0 switch (s.1_4) , case 0: , case 1: > it is not unmodified_parm_or_parm_agg_item (). The parameter is unsigned int so the cast is not value-preserving. Of course in general we can't rely on "proper" predicates so we need to avoid exploding reliably.