From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5D66D3873C85; Wed, 5 Jun 2024 17:55:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D66D3873C85 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1717610108; bh=TfckxFg9QOBAI+0TLVKGT0RvZYC/mkDqj9KC4qEm3TQ=; h=From:To:Subject:Date:From; b=aji/gxIgxt/3eCgWXE9X210JuJuKFLHfevuIlK8rur2jbCwF+EnXsWFVqD3vwc2/6 tOG3z9dpoot9WE2iYWhVvG6C6Df7BDeCjDbaC/M6LygFe6vxO2JLcjObvBwqFPwuMZ Mk/ZFywCYt0fSqZgQeAyQsAIxqZA6kflj1HHnTM8= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/115363] New: Missing loop vectorization due to loop bound load not being pulled out Date: Wed, 05 Jun 2024 17:55:04 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 15.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter 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=3D115363 Bug ID: 115363 Summary: Missing loop vectorization due to loop bound load not being pulled out Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` struct out { unsigned *array; }; struct m{ void f(out *output); void f1(out *output); int size; }; void m::f(out *output) { for (int k =3D 0; k < size; k++) { output->array[k] +=3D 1; } } void m::f1(out *output) { int tmp =3D size; for (int k =3D 0; k < size; k++) { output->array[k] +=3D 1; } } ``` We should be able to vectorize `m::f` but currently does not since this->si= ze might alias array[k]. But we could version the loop to pull out the this->size out of the loop an= d we could vectorize the loop then.=