From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0C26C3858D1E; Tue, 20 Dec 2022 03:02:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C26C3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671505321; bh=sYkBBWSCzbMYUE0+Mtex+pVwjQN2b4andZ7RCL6r3/w=; h=From:To:Subject:Date:From; b=tVSbp86RNVo9Rt8Mm3nRFN1o+ENTDlLNaieezIyHvvaeffPSdac43882THyxXedNg sB6sear6hLsCFBEL+eM3gYKK6r349K3i/yA+JZTb0fPZKwNob/A8UqtYnXdHoGtuXt uDUHxJM4LX5elKAFOSrS4i6l2N4LIHBAh4r71Pww= From: "linkw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/108184] New: rs6000: Use optimize_function_for_speed_p too early Date: Tue, 20 Dec 2022 03:01:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: linkw at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D108184 Bug ID: 108184 Summary: rs6000: Use optimize_function_for_speed_p too early Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: linkw at gcc dot gnu.org Target Milestone: --- In the review of patch [1] for PR105818, Honza pointed out=20 "I think we should generally avoid doing decisions about size/speed optimizations so early since the setting may change due to attributes or profile feedback..." I agreed that the current uses of optimize_function_for_speed_p in function rs6000_option_override_internal are too early and can be inaccurate. I trie= d to make the below test case to demonstrate it. Compiled with -mdejagnu-tune=3Dpower8 -O3: __attribute__ ((cold)) int fusion_short (short *p) { return p[0x12345]; } Since the function is attributed with cold, it's considered not to optimize= for speed, so we shouldn't break the sign extended loads and fuse it with the addis, that is it's unexpected to see extsh generated but we have: addis 3,3,0x2 lhz 3,18058(3) extsh 3,3 [1] https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607527.html=