From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0B7F03858D29; Wed, 22 Sep 2021 18:11:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B7F03858D29 From: "vmakarov at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/102147] IRA dependent on 32-bit vs 64-bit pointer size Date: Wed, 22 Sep 2021 18:11:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: internal-improvement, ra X-Bugzilla-Severity: normal X-Bugzilla-Who: vmakarov at gcc dot gnu.org 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: Wed, 22 Sep 2021 18:11:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102147 --- Comment #7 from Vladimir Makarov --- I've been thinking about ways to fix this problem but only come to the following patch. The patch results in working mostly the same for 64-bit targets and different for 32-bit targets. In any case the profitability is = only an estimation so I think the patch is ok. Avoiding 4 stage bootstrap is mo= re important than a bit slower RA on 32-bit targets (which is questionable) on= few border cases. I am going to commit the patch this Friday. --- a/gcc/ira-build.c +++ b/gcc/ira-build.c @@ -629,7 +629,7 @@ ior_hard_reg_conflicts (ira_allocno_t a, const_hard_reg= _set set) bool ira_conflict_vector_profitable_p (ira_object_t obj, int num) { - int nw; + int nbytes; int max =3D OBJECT_MAX (obj); int min =3D OBJECT_MIN (obj); @@ -638,9 +638,14 @@ ira_conflict_vector_profitable_p (ira_object_t obj, int num) in allocation. */ return false; - nw =3D (max - min + IRA_INT_BITS) / IRA_INT_BITS; - return (2 * sizeof (ira_object_t) * (num + 1) - < 3 * nw * sizeof (IRA_INT_TYPE)); + nbytes =3D (max - min) / 8 + 1; + STATIC_ASSERT (sizeof (ira_object_t) <=3D 8); + /* Don't use sizeof (ira_object_t), use constant 8. Size of ira_object_= t (a + pointer) is different on 32-bit and 64-bit targets. Usage sizeof + (ira_object_t) can result in different code generation by GCC built as 32- + and 64-bit program. In any case the profitability is just an estimat= ion + and border cases are rare. */ + return (2 * 8 /* sizeof (ira_object_t) */ * (num + 1) < 3 * nbytes); } /* Allocates and initialize the conflict vector of OBJ for NUM=