From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 14240385841D; Tue, 28 Nov 2023 12:02:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14240385841D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701172943; bh=dUXVdCVZWSsAp1Z583QdRMPtuftv4I1iN66Kj0natTM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TFdpo0te2HhgQas2EiCoOfU1n3RhjjcKHpABALZW1RY79zaVFA1dKVwyUzUxIgq5N yhYniQ735QwcdrFpgEdZ0YpRcSFxGUpn7JVpBsqHIgq830Djvqd+yqoqPfFvrMDxMs Ixg98vlSC82aZKonXejlBxgrJ57sDcsI/Rz20TwM= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112742] missed vectorization with src[a*b+i] where a*b is not int rather than same percission as size_type Date: Tue, 28 Nov 2023 12:02:22 +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: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenth 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112742 --- Comment #2 from Richard Biener --- Ah, row*stride is loop invariant and that saves us with -m32. With -m64 we end up with [local count: 105119324]: row.0_1 =3D (unsigned int) row_13(D); _2 =3D row.0_1 * stride_14(D); [local count: 955630224]: # col_20 =3D PHI col.1_3 =3D (unsigned int) col_20; _4 =3D _2 + col.1_3; _5 =3D (sizetype) _4; _6 =3D src_15(D) + _5; _7 =3D *_6; which is "unfortuante" association of the (sizetype) conversion. But as the col addtition is unsigned it might overflow and we can't associate the (sizetype) conversion but it makes the result non-affine. A runtime versioning would be necessary, guaranteeing that _2 + col.1_3 never overflows.=