From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 11FF1385829C; Thu, 7 Mar 2024 16:53:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 11FF1385829C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709830400; bh=VyEPQdmGOsvxIW+qhv5GxupM0G4oPICfFuiyGcDJYOM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bZE61XoXqrrO/jrPAWdT27ftbfSt9f1xVrNRETcbAC1Jp7Z/WCrQHmk7DanJvRt2O jvmDt02TgrcBGZxbfjXs5OR1oihz1EEihCBS9Bck2jMmCaL1hWfWiqyOgZtmEt/kte fjvW1hm3ZnJLnPUD6pIQh7E6sLyqGKPWxuAIMPDg= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/101523] Huge number of combine attempts Date: Thu, 07 Mar 2024 16:53:17 +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: compile-time-hog, memory-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: segher 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101523 --- Comment #26 from Andrew Pinski --- So looking into the s390 backend, I notice that s390_address_cost says the addressing mode `base+index` is slightly more expensive than just `base`: from s390_address_cost : return ad.indx? COSTS_N_INSNS (1) + 1 : COSTS_N_INSNS (1); BUT then s390_rtx_costs when looking at MEM does not take into account the addressing for the cost there (it does take into account on the LHS though): ``` case MEM: *total =3D 0; return true; ``` This mismatch does cause some issues. Basically fwprop uses address_cost to figure out when it is replacing into MEM but combine just uses insn_cost/rtx_cost . So while fwprop rejects it as being worse and then combine comes along and does it. I suspect if we change the s390 backend just slightly to set the cost when there is an index to the address to 1 for the MEM, combine won't be acting = up here. Basically putting in sync the 2 cost methods.=