From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 434353858281; Fri, 18 Nov 2022 08:54:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 434353858281 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668761681; bh=hIgyQWyBGhDye8RuezTi0hgxHe/zpwGlPS5e4oHcbjQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ANdmhfk6i5QqYnwbgSKtE0NmWz5cLQs/FzsEdL7sYNhNmPkZWwyUdKlCM18npJzEw 8tAGi+Xq7+g5/kPKpqfn/5Z/bB0m1t5DUU5ZxMh6Hm3tDPqcf6EklpGw5iL2zYl/Z2 k131gMOXiWY7lNYYYPRKA6b59wtfIzMhMk+7lqaI= From: "slyfox at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/107661] [13 Regression] lambdas get merged incorrectly in tempaltes, cause llvm-12 miscompilation since r13-3358-ge0403e95689af7 Date: Fri, 18 Nov 2022 08:54:41 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: blocker X-Bugzilla-Who: slyfox at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jamborm at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107661 --- Comment #10 from Sergei Trofimovich --- I think ipa-cp adds the call edge info in wrong direction. a.cc.081i.cp sni= ppet around do3() param1 (our callback): IPA lattices after all propagation: Lattices: ... Node: void do3(volatile int*, function_ref)/25: ... param [1]: VARIABLE ctxs: VARIABLE Bits unusable (BOTTOM) [irange] int VARYING offset 0: callback_fn_L [scc: 3, from: 25(0.330000) 26(1.000000)] [loc_time: 17, loc_size: 13, prop_time: 17, prop_size: 13] callback_fn_R [scc: 4, from: 25(0.330000) 26(1.000000)] [loc_time: 9, loc_size: 13, prop_time: 9, prop_size: 13] ... Evaluating opportunities for void do3(volatile int*, function_ref)/25. - considering value callback_fn_L for param #1 Expired, offset: 0 (caller_count: 2) good_cloning_opportunity_p (time: 17, size: 13, freq_sum: 1.33, self_scc) -> evaluation: 1739.23, threshold: 500 Creating a specialized node of void do3(volatile int*, function_ref)/25. the new node is void do3.constprop(volatile int*, function_ref)/33. Aggregate replacements: 1[0]=3Dcallback_fn_L ipa-prop: Discovered an indirect call to a known target (void do3.constprop(volatile int*, function_ref)/33 -> void callback_fn_L()/15), = for stmt _1 (); ../a.cc:37:19: optimized: converting indirect call in void do3.constprop(volatile int*, function_ref)/33 to direct call to void callback_fn_L()/15 Evaluating opportunities for void do3(volatile int*, function_ref)/25. - adding an extra caller void do3(volatile int*, function_ref)/25 of v= oid do3.constprop(volatile int*, function_ref)/33 Note: the uncloned do3() is a self-recursive function. I would expect cloned do3.constprop() to refer to uncloned do3(). If I read "adding an extra caller" correctly it adds an edge in wrong direction: do3() now calls do3.constptop().=