From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6C36C3858C56; Thu, 13 Oct 2022 22:34:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6C36C3858C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665700464; bh=j4Nhym40hj25sQwwrqWDRYWEIVT1upTLwiCwU2zVi4k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EssK5nByn7VTVDKjlTGsUe97xllwlGxoNISxp+qeKGTVHxxVrSVhN3yneQiLmSfve eDE71+S0VmxuYwOAtMxwAJYzkQJVuwaGMdnfOdd9XH2d4secwI9qFv0Df+N3z/uPrA +VfOTGkMLBsJ3NYf4QwKq6ofU9EPzy2CGsEfeRQc= From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/107172] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1268-g8c99e307b20c502e Date: Thu, 13 Oct 2022 22:34:18 +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: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl.tools at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 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=3D107172 --- Comment #32 from H.J. Lu --- (In reply to Segher Boessenkool from comment #30) > (In reply to H.J. Lu from comment #26) > > LTU/GEU are only used to check FLAGS_REG against constant 0. >=20 > That is not what > (ltu (reg 17) (const_int 0)) > means though? >=20 > Together with a previous > (set (reg 17) (compare A B)) >=20 > it means the result of A <=3D B. That is correct. > There is no actual comparison with 0, that is just notation. True. But simplify-rtx.cc simplifies (ltu (reg 17) (const_int 0)) to false when reg 17 is set. > > simplify_const_relational_operation has > >=20 > > /* We can't simplify MODE_CC values since we don't know what the > > actual comparison is. */ > > if (GET_MODE_CLASS (GET_MODE (op0)) =3D=3D MODE_CC) > > return 0; >=20 > And combine *does* know how to find the actual comparison, in many cases.= =20 > Some > other passes can as well, there is no magic involved, you just need to lo= ok > at > other insns as well (just one really, the CC setter). Use the actual comparison isn't issue. The issue is how (ltu (reg 17) (const_int 0)) should be simplified when reg 17 is known to be set.=