From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9FCE63858C60; Tue, 27 Feb 2024 06:13:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9FCE63858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709014389; bh=DrxhqaeZnIVh1/+2urHQXTadi4R4ZL8C/g3xnHFzNPE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UtCbxEaqzaS61eh/hyQKlXzaYcEG3EF5Kc89UQ+ENMTcOkZrUz7EBRzgxi6QzvgXb FknaaTR96+dE500aEkw3HlSamiWEaOrPLve6ycv2VufLdadHCTCueNnRiXlQLeuV9M JPNSXOHvZsKO63p2xVwtLRJUWGyecwEHVtrflLkI= From: "liuhongt at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112325] Missed vectorization of reduction after unrolling Date: Tue, 27 Feb 2024 06:13:09 +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: normal X-Bugzilla-Who: liuhongt 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=3D112325 --- Comment #10 from Hongtao Liu --- (In reply to Hongtao Liu from comment #9) > The original case is a little different from the one in PR. But the issue is similar, after cunrolli, GCC failed to vectorize the outer loop. The interesting thing is in estimated_unrolled_size, the original unr_insns= is 288 which is bigger than param_max_completely_peeled_insns(200), but unr_in= sn is decreased by 1/3 due to Loop body is likely going to simplify further, this is difficult to guess, we just decrease the result by 1/3. */ In practice, this loop body is not simplied for 1/3 of the instructions. Considering the unroll factor is 16, the unr_insn is large(192), I was wondering if we could add some heuristic algorithm to avoid complete loop unroll, because usually for such a big loop, both loop and BB vectorizer may not perform well.=