From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 10BCF3858D32; Mon, 18 Sep 2023 22:32:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 10BCF3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695076349; bh=Tt4NCm+AAV6OW+DTVJ6fFwbjDwIf9ES7Xv+bEgJyL20=; h=From:To:Subject:Date:From; b=hppF09iUWS6OQB0ZBHl2h+sxxFcgWtRoHL9wzPTd2O2esXowgwWJ2b9DzQ/gYRUFC Rt2PZTYHL9rN37YGZXXNatFq35Fp7/dN4Eu4VRb+j37+bj7+AdmKZVYo+t8fzuhHjm oGMhBip/o9oYblYZunmfVsdPgW6YDFFxtCn9LQgU= From: "vineetg at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/111467] New: REE failing to eliminate redundant extension due to multiple reaching def(s) Date: Mon, 18 Sep 2023 22:32:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vineetg at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: vineetg 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 cc 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=3D111467 Bug ID: 111467 Summary: REE failing to eliminate redundant extension due to multiple reaching def(s) Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: vineetg at gcc dot gnu.org Reporter: vineetg at gcc dot gnu.org CC: jeffreyalaw at gmail dot com, jivanhakobyan9 at gmail d= ot com, kito at gcc dot gnu.org, palmer at gcc dot gnu.org Target Milestone: --- For the trivial test case below (credit goes to Palmer for mentioning this almost 2 years ago). int foo6(int a, int b) { return a > b ? a : b; } -O2 -march=3Drv64gc foo6: mv a5,a1 bge a1,a0,.L5 mv a5,a0 .L5: sext.w a0,a5 ret REE fails to eliminate the sign extension due to multiple reaching definiti= ons constraint. I don't know how involved or runtime cost relaxing the constraint is, so opening this PR to investigate. FWIW a zba build generates a max insn, eliminating the sext.w, but the vani= lla case shows where things can possibly be improved.=