From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15051 invoked by alias); 24 Feb 2014 13:48:38 -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 14985 invoked by uid 48); 24 Feb 2014 13:48:30 -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 13:48: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/msg02442.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60315 --- Comment #5 from Richard Biener --- Hmm, ok - it is supposed to only account for the extra call edges in the inlined bodies. The actual issue seems to be Deciding on inlining of small functions. Starting with size 114. Enqueueing calls in Test::Test(Scale) [with Scale scale = (Scale)3u]/14. Enqueueing calls in Test::Test(Scale) [with Scale scale = (Scale)3u]/13. Estimating body: Test::Test(Scale) [with Scale scale = (Scale)3u]/13 Known to be false: not inlined, op1 != 3, op1 changed size:0 time:0 enqueuing call Test::Test(Scale) [with Scale scale = (Scale)3u]/13 -> Test::Test(Scale) [with Scale scale = (Scale)3u]/14, badness -1073741826 Estimating body: Test::Test(Scale) [with Scale scale = (Scale)2u]/9 Known to be false: not inlined, op1 != 2, op1 changed size:0 time:0 enqueuing call Test::Test(Scale) [with Scale scale = (Scale)3u]/13 -> Test::Test(Scale) [with Scale scale = (Scale)2u]/10, badness -1073741827 Estimating body: Test::Test(Scale) [with Scale scale = (Scale)1u]/5 Known to be false: not inlined, op1 != 1, op1 changed size:0 time:0 ... Considering Test::Test(Scale) [with Scale scale = (Scale)2u]/9 with 27 size to be inlined into Test::Test(Scale) [with Scale scale = (Scale)3u]/13 in t.C:21 Estimated growth after inlined into all is +27 insns. Estimated badness is -1073741827, frequency 0.16. Badness calculation for Test::Test(Scale) [with Scale scale = (Scale)3u]/13 -> Test::Test(Scale) [with Scale scale = (Scale)2u]/10 size growth -3, time 0 inline hints: in_scc declared_inline -1073741827: Growth -3 <= 0 Processing frequency Test::Test(Scale) [with Scale scale = (Scale)2u] Called by Test::Test(Scale) [with Scale scale = (Scale)3u] that is normal or hot Estimating body: Test::Test(Scale) [with Scale scale = (Scale)3u]/13 Known to be false: not inlined, op1 != 3, op1 changed size:0 time:0 Estimating body: Test::Test(Scale) [with Scale scale = (Scale)0u]/2 Known to be false: not inlined, op1 != 0, op1 changed size:0 time:0 enqueuing call Test::Test(Scale) [with Scale scale = (Scale)2u]/30 -> Test::Test(Scale) [with Scale scale = (Scale)0u]/3, badness -1073741827 Estimating body: Test::Test(Scale) [with Scale scale = (Scale)1u]/5 Known to be false: not inlined, op1 != 1, op1 changed size:0 time:0 enqueuing call Test::Test(Scale) [with Scale scale = (Scale)2u]/30 -> Test::Test(Scale) [with Scale scale = (Scale)1u]/6, badness -1073741827 Estimating body: Test::Test(Scale) [with Scale scale = (Scale)2u]/9 Known to be false: not inlined, op1 != 2, op1 changed size:0 time:0 enqueuing call Test::Test(Scale) [with Scale scale = (Scale)2u]/30 -> Test::Test(Scale) [with Scale scale = (Scale)2u]/10, badness -1073741827 Estimating body: Test::Test(Scale) [with Scale scale = (Scale)3u]/13 Known to be false: not inlined, op1 != 3, op1 changed size:0 time:0 enqueuing call Test::Test(Scale) [with Scale scale = (Scale)2u]/30 -> Test::Test(Scale) [with Scale scale = (Scale)3u]/14, badness -1073741826 Estimating body: Test::Test(Scale) [with Scale scale = (Scale)3u]/13 Known to be false: not inlined, op1 != 3, op1 changed size:0 time:0 Estimating body: Test::Test(Scale) [with Scale scale = (Scale)3u]/13 Known to be false: not inlined, op1 != 3, op1 changed size:0 time:0 Estimating body: Test::Test(Scale) [with Scale scale = (Scale)3u]/13 Known to be false: not inlined, op1 != 3, op1 changed size:0 time:0 Inlined into Test::Test(Scale) [with Scale scale = (Scale)3u] which now has time 13 and size 24,net change of -3. New minimal size reached: 111 Estimating body: Test::Test(Scale) [with Scale scale = (Scale)1u]/5 Known to be false: not inlined, op1 != 1, op1 changed size:0 time:0 Considering Test::Test(Scale) [with Scale scale = (Scale)1u]/5 with 27 size to be inlined into Test::Test(Scale) [with Scale scale = (Scale)0u]/2 in t.C:20 Estimated growth after inlined into all is +27 insns. Estimated badness is -1073741827, frequency 0.12. Badness calculation for Test::Test(Scale) [with Scale scale = (Scale)0u]/2 -> Test::Test(Scale) [with Scale scale = (Scale)1u]/6 size growth -3, time 0 inline hints: declared_inline -1073741827: Growth -3 <= 0 ... so we are inlining all over the place but don't really arrive at a point where no further useful inlining is left and inlining never has a growth effect in our theory and we continue to think that we shrink the overall unit by further inlining. Meanwhile the cgraph is full of millions of calls (but estimated to be never reached?): Considering Test::Test(Scale) [with Scale scale = (Scale)0u]/2 with 24 size to be inlined into Test::Test(Scale) [with Scale scale = (Scale)0u]/76 in t.C:19 Estimated growth after inlined into all is +24 insns. Estimated badness is -1073741827, frequency 0.00. Badness calculation for Test::Test(Scale) [with Scale scale = (Scale)0u]/76 -> Test::Test(Scale) [with Scale scale = (Scale)0u]/3 size growth -3, time 0 inline hints: in_scc declared_inline -1073741827: Growth -3 <= 0 not inlining recursively: recursive call is cold Estimating body: Test::Test(Scale) [with Scale scale = (Scale)3u]/13 Known to be false: not inlined, op1 != 3, op1 changed size:0 time:0 I wonder if we can somehow prune those edges we don't consider inlining early ...