From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C226A38930C4; Mon, 15 Feb 2021 09:57:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C226A38930C4 From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/99083] Big run-time regressions of 519.lbm_r with LTO Date: Mon, 15 Feb 2021 09:57:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: missed-optimization, ra X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: NEW 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: 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 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: Mon, 15 Feb 2021 09:57:02 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99083 --- Comment #3 from Uro=C5=A1 Bizjak --- It looks to me another one is in reload1.c, find_reg: if (this_cost < best_cost /* Among registers with equal cost, prefer caller-saved ones,= or use REG_ALLOC_ORDER if it is defined. */ || (this_cost =3D=3D best_cost #ifdef REG_ALLOC_ORDER && (inv_reg_alloc_order[regno] < inv_reg_alloc_order[best_reg]) #else && crtl->abi->clobbers_full_reg_p (regno) && !crtl->abi->clobbers_full_reg_p (best_reg) #endif )) { best_reg =3D regno; best_cost =3D this_cost; } According to the comment, REG_ALLOC_ORDER has to be defined to use preferen= ces. As mentioned by Richard in Comment #2, x86 defines ADJUST_REG_ALLOC_ORDER, where the real allocation order is computed. But the documentation doesn't mention that REG_ALLOC_ORDER also needs to be defined. It explicitly says e= ven: The macro body should not assume anything about the contents of 'reg_alloc_order' before execution of the macro. But, we want to use the order from reg_alloc_order, so x86 should define HONOR_REG_ALLOC_ORDER: -- Macro: HONOR_REG_ALLOC_ORDER Normally, IRA tries to estimate the costs for saving a register in the prologue and restoring it in the epilogue. This discourages it from using call-saved registers. If a machine wants to ensure that IRA allocates registers in the order given by REG_ALLOC_ORDER even if some call-saved registers appear earlier than call-used ones, then define this macro as a C expression to nonzero. Default is 0. But... x86_order_regs_for_local_alloc lists general call_used_or_fixed_regs first,= so it should not matter anyway as far as call_used regs are concerned.=