From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5C16B3858D38; Thu, 28 Dec 2023 04:02:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5C16B3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703736150; bh=hnMYYVXrC6WUfwcmmthKxpQpII6QSoDE2+idLroQ+gI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=d+oU1P1c+udUwrms53RTdmios7Gw4VpgYQ4uN+r6rDpf+3QU0FVp8LtBH80upOzVw w9fPXTofuvO5EYgBICurAO+12tdGHWImCrqOUG0RCPCmHAfiYjFOuRp2IwZLjspzIj NGfoYRJGQ+oFxiQfqax9JNxY5nqJ01S7qIcBgZyo= From: "tnfchris at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects Date: Thu, 28 Dec 2023 04:02:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: tnfchris 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=3D113134 --- Comment #6 from Tamar Christina --- (In reply to JuzheZhong from comment #5) > (In reply to Tamar Christina from comment #4) > > (In reply to JuzheZhong from comment #3) > > > I guess this code is just disabling partial vector for length for now. > > >=20 > > > And need me to test and port this part for length in the followup pat= ches. > > >=20 > > > Am I right ? > >=20 > > Yeah, it needed to safely not allow it through for now. Once implemente= d=20 > > you'll hit an assert in vectorizable_live_operations where you need to > > provide a way to also get the first active element from a vector. >=20 > So for a length target, I enable cbranch optab but no vcond_mask_len opta= b. > Will it behavior wrong ? >=20 You need both, if the operation requires a mask it'll reject it without vcond_mask_len support. Because I didn't know how to extract first element using vcond_mask_len I had to disable it. > Another question is could you give me more hints about > vectorizable_live_operation? >=20 > I thought vectorizable_live_operation is doing extract last active elemen= t, > I didn't see extract first active element. Normally yes, but I added extract first active element for this patch. Thi= s is because when you hit and take an early exit we restrart the vector iteration since there may be partial effects to perform between where the loop started and where the element is found. specifically look at vectorizable_live_operation_1 there's an assert under= =20 if (LOOP_VINFO_FULLY_WITH_LENGTH_P (loop_vinfo)) with a comment saying what's needed.=