From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E2268385E021; Mon, 30 Mar 2020 09:23:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E2268385E021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1585560204; bh=v60nj/fx6wqq5EQMDP/JNq4HltzIKMfImV3r+x1xZ7A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GztykmiBhL79s2Hf9WYF3AM+1TcSWUBEqMz80I2zW4VqZjPPEB6GhTMiID+YfoeYy XAPmiJ49Ekp86HsglOCDgh0TMUVp6bA7SE1Z8guf1O8D0O99fAMwtb4t3qnuF0K1eS AWjTKGKbTxXYLlI4f7Lr13QLirbCNNHl1dr+xvSs= From: "z.zhanghaijian at huawei dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94398] ICE: in vectorizable_load, at tree-vect-stmts.c:9173 Date: Mon, 30 Mar 2020 09:23:24 +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: 10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: z.zhanghaijian at huawei dot com 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: 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: Mon, 30 Mar 2020 09:23:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94398 --- Comment #1 from z.zhanghaijian at huawei dot com --- (gdb) bt #0 aarch64_builtin_support_vector_misalignment (mode=3DE_VNx4SFmode, type=3D0xffffb79ec2a0, misalignment=3D-1, is_packed=3Dfalse) at ../../gcc-git/gcc/config/aarch64/aarch64.c:17510 #1 0x000000000220631c in vect_supportable_dr_alignment (dr_info=3D0x2ef379= 8, check_aligned_accesses=3Dfalse) at ../../gcc-git/gcc/tree-vect-data-refs.c:= 6618 #2 0x000000000162fc9c in vectorizable_load (stmt_info=3D0x2ef3770, gsi=3D0xffffffffe0b0, vec_stmt=3D0xffffffffdde0, slp_node=3D0x0, slp_node_instance=3D0x0, cost_vec=3D0x0) at ../../gcc-git/gcc/tree-vect-stmts.c:9172 #3 0x0000000001635174 in vect_transform_stmt (stmt_info=3D0x2ef3770, gsi=3D0xffffffffe0b0, slp_node=3D0x0, slp_node_instance=3D0x0) at ../../gcc-git/gcc/tree-vect-stmts.c:11034 #4 0x000000000165a340 in vect_transform_loop_stmt (loop_vinfo=3D0x2ed0ad0, stmt_info=3D0x2ef3770, gsi=3D0xffffffffe0b0, seen_store=3D0xffffffffe0a8) at ../../gcc-git/gcc/tree-vect-loop.c:8307 #5 0x000000000165b5c4 in vect_transform_loop (loop_vinfo=3D0x2ed0ad0, loop_vectorized_call=3D0x0) at ../../gcc-git/gcc/tree-vect-loop.c:8708 #6 0x0000000001689f08 in try_vectorize_loop_1 (simduid_to_vf_htab=3D@0xffffffffed68: 0x0, num_vectorized_loops=3D0xffffff= ffed7c, loop=3D0xffffb7820000, loop_vectorized_call=3D0x0, loop_dist_alias_call=3D0x0) at ../../gcc-git/gcc/tree-vectorizer.c:990 #7 0x000000000168a184 in try_vectorize_loop (simduid_to_vf_htab=3D@0xffffffffed68: 0x0, num_vectorized_loops=3D0xffffff= ffed7c, loop=3D0xffffb7820000) at ../../gcc-git/gcc/tree-vectorizer.c:1047 #8 0x000000000168a330 in vectorize_loops () at ../../gcc-git/gcc/tree-vectorizer.c:1127 #9 0x00000000014e55e4 in (anonymous namespace)::pass_vectorize::execute (this=3D0x2d6f860, fun=3D0xffffb7817000) at ../../gcc-git/gcc/tree-ssa-loop= .c:414 #10 0x000000000113dec0 in execute_one_pass (pass=3D0x2d6f860) at ../../gcc-git/gcc/passes.c:2502 #11 0x000000000113e284 in execute_pass_list_1 (pass=3D0x2d6f860) at ../../gcc-git/gcc/passes.c:2590 #12 0x000000000113e2c0 in execute_pass_list_1 (pass=3D0x2d6f070) at ../../gcc-git/gcc/passes.c:2591 #13 0x000000000113e2c0 in execute_pass_list_1 (pass=3D0x2d6dd00) at ../../gcc-git/gcc/passes.c:2591 #14 0x000000000113e32c in execute_pass_list (fn=3D0xffffb7817000, pass=3D0x= 2d6db20) at ../../gcc-git/gcc/passes.c:2601 #15 0x0000000000be2f50 in cgraph_node::expand (this=3D0xffffb79dc870) at ../../gcc-git/gcc/cgraphunit.c:2299 #16 0x0000000000be3814 in expand_all_functions () at ../../gcc-git/gcc/cgraphunit.c:2470 #17 0x0000000000be45c4 in symbol_table::compile (this=3D0xffffb79ce000) at ../../gcc-git/gcc/cgraphunit.c:2820 #18 0x0000000000be4b14 in symbol_table::finalize_compilation_unit (this=3D0xffffb79ce000) at ../../gcc-git/gcc/cgraphunit.c:3000 #19 0x000000000129f7dc in compile_file () at ../../gcc-git/gcc/toplev.c:483 #20 0x00000000012a3a14 in do_compile () at ../../gcc-git/gcc/toplev.c:2273 #21 0x00000000012a3de0 in toplev::main (this=3D0xfffffffff148, argc=3D21, argv=3D0xfffffffff298) at ../../gcc-git/gcc/toplev.c:2412 #22 0x000000000224a038 in main (argc=3D21, argv=3D0xfffffffff298) at ../../gcc-git/gcc/main.c:39 (gdb) p misalignment $3 =3D -1 (gdb) p mode $4 =3D E_VNx4SFmode vect_supportable_dr_alignment is expected to return either dr_aligned or dr_unaligned_supported for masked operations. But it seems that this functi= on only catches internal_fn IFN_MASK_LOAD & IFN_MASK_STORE. We are emitting a mask gather load here for this test case. As backends ha= ve their own vector misalignment support policy, I am supposing this should be better handled in the auto-vect shared code. Proposed fix by felix.yang@huawei.com: diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 0192aa6..67d3345 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -6509,11 +6509,26 @@ vect_supportable_dr_alignment (dr_vec_info *dr_info, /* For now assume all conditional loads/stores support unaligned access without any special code. */ - if (gcall *stmt =3D dyn_cast (stmt_info->stmt)) - if (gimple_call_internal_p (stmt) - && (gimple_call_internal_fn (stmt) =3D=3D IFN_MASK_LOAD - || gimple_call_internal_fn (stmt) =3D=3D IFN_MASK_STORE)) - return dr_unaligned_supported; + gcall *call =3D dyn_cast (stmt_info->stmt); + if (call && gimple_call_internal_p (call)) + { + internal_fn ifn =3D gimple_call_internal_fn (call); + switch (ifn) + { + case IFN_MASK_LOAD: + case IFN_MASK_LOAD_LANES: + case IFN_MASK_GATHER_LOAD: + case IFN_MASK_STORE: + case IFN_MASK_STORE_LANES: + case IFN_MASK_SCATTER_STORE: + return dr_unaligned_supported; + default: + break; + } + } + + if (loop_vinfo && LOOP_VINFO_FULLY_MASKED_P (loop_vinfo)) + return dr_unaligned_supported; if (loop_vinfo) {=