From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6EE583858CD1; Thu, 18 Jan 2024 08:49:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6EE583858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705567797; bh=+5ZoV+4ShXHktBOF9GUl90wKh4+oz1WV5qBGbFbeVk0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=p44mqIvT3/5su2fkDcdvzbGEu5L4AmLqdSNbIOnY+Zl9Bmi5tF1gATFH5qBvG1tOS pvZHB00has4tGA+ziCOzcfk8RZcZ2VDkO2hOKJ0Q5Gd/GS/5jz235sPcWTv1IEouoN xugB5O0d6hVbjK/9JYHri5oUdp2AolIzK4B3KujQ= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113467] [14 regression] libgcrypt-1.10.3 is miscompiled Date: Thu, 18 Jan 2024 08:49:56 +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: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.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=3D113467 --- Comment #7 from Richard Biener --- I do wonder whether LOOP_VINFO_EARLY_BREAKS_VECT_PEELED actually works (sin= ce without early exits we cannot handle a non-empty latch because of correctne= ss issues). I'd very much have preferred to deal with these by loop rotation (there's the loop_ch pass). We're still doing this, even when LOOP_VINFO_EARLY_BREAKS_VECT_PEELED: /* We assume that the loop exit condition is at the end of the loop. i.e, that the loop is represented as a do-while (with a proper if-guard before the loop if needed), where the loop header contains all the executable statements, and the latch is empty. */ if (!empty_block_p (loop->latch) || !gimple_seq_empty_p (phi_nodes (loop->latch))) return opt_result::failure_at (vect_location, "not vectorized: latch block not empty.\= n"); so that's a bit odd (but loop_ch tries to ensure the latch is empty anyway). Does the following fix the issue? diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 330c4571c8d..b67ee783002 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -998,6 +1000,9 @@ vec_init_loop_exit_info (class loop *loop) } } + if (candidate->src !=3D single_pred (loop->latch)) + return NULL; + return candidate; }=