From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B9C343858403; Wed, 1 Dec 2021 08:19:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9C343858403 From: "linkw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/103515] New: Unexpected OPTION_MASK_SAVE_TOC_INDIRECT of rs6000_isa_flag Date: Wed, 01 Dec 2021 08:19:51 +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: 12.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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Dec 2021 08:19:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103515 Bug ID: 103515 Summary: Unexpected OPTION_MASK_SAVE_TOC_INDIRECT of rs6000_isa_flag Product: gcc Version: 12.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: --- Test case: gcc/testsuite/g++.dg/torture/pr81360.C Option: -fno-early-inlining -Os For function rs6000_can_inline_p, I tried to test if the rs6000_isa_flag is always the same (expected) as the TREE_TARGET_OPTION (target_option_default_node)->x_rs6000_isa_flags) when the caller_tree is N= ULL. The regression testing on LE/BE showed up this failure. By investigating it= , I noticed it's a bug. Since the command line option is -Os, we should not set this=20 OPTION_MASK_SAVE_TOC_INDIRECT for most functions there: /* If we can shrink-wrap the TOC register save separately, then use -msave-toc-indirect unless explicitly disabled. */ if ((rs6000_isa_flags_explicit & OPTION_MASK_SAVE_TOC_INDIRECT) =3D=3D 0 && flag_shrink_wrap_separate && optimize_function_for_speed_p (cfun)) rs6000_isa_flags |=3D OPTION_MASK_SAVE_TOC_INDIRECT; But after compiler parsing the function main with "#pragma GCC optimize ("-O0")", the rs6000_isa_flags would always get this OPTION_MASK_SAVE_TOC_INDIRECT on, even if the context is not for the functi= on main.=