From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 412273858C2A; Thu, 3 Aug 2023 09:32:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 412273858C2A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691055173; bh=3eCA9rnZ0i/H31wDW/TY1dN3IL8i24K7/YH25+cNe4k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DviY6MEI8KJeHTWAIw+mJzHVxPBsIpeuHvcshIc0xb4jwuw7jhQjPHfbkhZlaP5Kw UsDevj5nEoE3BRK9L1mmlC3D6F7NvExhoDe8yD7jgrV9cqxn9y7T7i/qGpWcGmSEQo ewGrMmiV8g77clW61Uo4NDOoJxmFkSCurniY2Rh8= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110702] [12/13/14 Regression] Wrong code at -O1 on x86_64-linux-gnu (regression since GCC-12.2) Date: Thu, 03 Aug 2023 09:32:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords bug_status cc assigned_to component 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=3D110702 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|needs-bisection | Status|NEW |ASSIGNED CC| |hubicka at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org Component|middle-end |tree-optimization --- Comment #4 from Richard Biener --- I think the bisected rev just exposes an existing issue. Namely IVOPTs generates _1 =3D MEM[(long int *)_52]; _3 =3D MEM[(long int *)0B + ivtmp.36_9 + ivtmp.28_44 * 4]; _4 =3D (int) _3; _2 =3D (int) _1; _5 =3D _2 | _4; with -fno-ivopts it works fine and we sink _1 =3D e[0][0][b.7_29]; _3 =3D e[a.9_30][b.7_29][a.9_30]; the issue is without IVOPTs the late pure-const pass correctly does nothing but with IVOPTs and the above MEMs we get it to produce pure because: scanning: _1 =3D MEM[(long int *)_52]; Indirect ref read is not const NULL memory access; terminating BB which is because infer_nonnull_range_by_dereference eventually does static bool check_loadstore (gimple *, tree op, tree, void *data) { if (TREE_CODE (op) =3D=3D MEM_REF || TREE_CODE (op) =3D=3D TARGET_MEM_REF) {=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 /* Some address spaces may legitimately dereference zero. */ addr_space_t as =3D TYPE_ADDR_SPACE (TREE_TYPE (op)); if (targetm.addr_space.zero_address_valid (as)) return false; return operand_equal_p (TREE_OPERAND (op, 0), (tree)data, 0);=