From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A58C63857818; Tue, 22 Feb 2022 14:52:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A58C63857818 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') Date: Tue, 22 Feb 2022 14:52:15 +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: 12.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Feb 2022 14:52:15 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101636 --- Comment #14 from Richard Biener --- Created attachment 52492 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52492&action=3Dedit GIMPLE testcase So I think that the IL we produce from SLP vectorizing the if-converted loop body is not great and we should address this issue there. In particular emitting a VECTOR_BOOLEAN_TYPE_P CTOR for the external bools is not OK which is also w= hat the iffy code in vect_create_constant_vectors shows. A non-loop GIMPLE testcase for this is attached. It doesn't ICE but the code generated is just awful. I've tried to compensate in vect_create_constant_vectors itself by creating a non-VECTOR_BOOLEAN_TYPE_P CTOR and producing a VECTOR_BOOLEAN_TYPE_P via a NE comparison but with just AVX512F we can handle V16SImode compares but not V16QImode which is what would naturally appear - and vector lowering wi= ll decompose that again and we have no means of failing vectorization in this function. Instead I think this needs to be handled by patterns and if it is not, rejected. In this case it's vectorizable_operation for bitwise ops that just picks the result vector type here /* If op0 is an external or constant def, infer the vector type from the scalar type. */ if (!vectype) { /* For boolean type we cannot determine vectype by invariant value (don't know whether it is a vector of booleans or vector of integers). We use output vectype because operations on boolean don't change type. */ if (VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (op0))) { if (!VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (scalar_dest))) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, "not supported operation on bool value.\n"= ); return false; } vectype =3D vectype_out; } but that assumes we can create a vector bool from invariants or externals which we generally cannot. If we disable that here we'll run into the same issue for the COND_EXPR. Looking at vect_recog_bool_pattern it really does two things at the same ti= me, optimize |& sequences _and_ perform correctness transforms based on mask uses. In this case we only start from the COND_EXPR as a mask use but once we see the internal-def & external-def mask def we decide we do not want to optimize it. But we'd still need to make the external def suitable for the mask use (and we know the precision to use there).=