From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by sourceware.org (Postfix) with ESMTPS id 28E853857C7D for ; Tue, 12 Jul 2022 19:11:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 28E853857C7D Received: by mail-ed1-x52b.google.com with SMTP id r18so11322038edb.9 for ; Tue, 12 Jul 2022 12:11:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Yt2MAStNlQZpkpLMRPyrnzlPIe8/YwGsrm1QCZ36EEM=; b=PFqiymGj/78iTySHInZM3/bW2zAYsh4oaHxkZUBs80/2uci7d4Foyg2G2pSPQVsSBT Q34hKrK6F9u/nJvrFGzAK7SppgO5hwAFiXr8BwZdaINcPyUiYIgtkiZBZAuCpFYGOPwi 4rj4uXAIw53cojwop0AXaZZmAm7fp644s2v6dKU7Fx2zBGjuZPwkhmqdofpcuvGEPN2+ ZZCduTenf6c2nMJq5RX7fOeC61mnr3gBPAx3s1SzBDcgaAzOICgN/i4YP+AWEAUIhgwV Sy4PbXivnbOaUciqKQqQYFkkZBoIpN23F0BMQpRECEV5+PpF8eLNozal+YfJo2+d20gc PhCg== X-Gm-Message-State: AJIora+Mv5GTBNt8kx0y9xsk89qRDRINftBj4ag4bHz7iZPZ7QdnE1PG 61E1gdaUhk8dJ7V69zgN5T/kY2VAUlb0MYkcH/15zqm/ecmtfYbT X-Google-Smtp-Source: AGRyM1tcNELIcOhPyAI85JfR7fpyrijmw4go7ZOBxOMelXDqkKpK1zGCb3nROk0j7OXH/n68ySRVrDEnE8rVRFbbV+A= X-Received: by 2002:a05:6402:3807:b0:435:20fb:318d with SMTP id es7-20020a056402380700b0043520fb318dmr33355494edb.272.1657653101504; Tue, 12 Jul 2022 12:11:41 -0700 (PDT) MIME-Version: 1.0 From: Prathamesh Kulkarni Date: Wed, 13 Jul 2022 00:41:04 +0530 Message-ID: Subject: ICE after folding svld1rq to vec_perm_expr duing forwprop To: gcc Patches , Richard Sandiford Content-Type: multipart/mixed; boundary="00000000000046df0005e3a070bf" X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2022 19:11:45 -0000 --00000000000046df0005e3a070bf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Richard, For the following test: svint32_t f2(int a, int b, int c, int d) { int32x4_t v =3D (int32x4_t) {a, b, c, d}; return svld1rq_s32 (svptrue_b8 (), &v[0]); } The compiler emits following ICE with -O3 -mcpu=3Dgeneric+sve: foo.c: In function =E2=80=98f2=E2=80=99: foo.c:4:11: error: non-trivial conversion in =E2=80=98view_convert_expr=E2= =80=99 4 | svint32_t f2(int a, int b, int c, int d) | ^~ svint32_t __Int32x4_t _7 =3D VIEW_CONVERT_EXPR<__Int32x4_t>(_8); during GIMPLE pass: forwprop dump file: foo.c.109t.forwprop2 foo.c:4:11: internal compiler error: verify_gimple failed 0xfda04a verify_gimple_in_cfg(function*, bool) ../../gcc/gcc/tree-cfg.cc:5568 0xe9371f execute_function_todo ../../gcc/gcc/passes.cc:2091 0xe93ccb execute_todo ../../gcc/gcc/passes.cc:2145 This happens because, after folding svld1rq_s32 to vec_perm_expr, we have: int32x4_t v; __Int32x4_t _1; svint32_t _9; vector(4) int _11; : _1 =3D {a_3(D), b_4(D), c_5(D), d_6(D)}; v_12 =3D _1; _11 =3D v_12; _9 =3D VEC_PERM_EXPR <_11, _11, { 0, 1, 2, 3, ... }>; return _9; During forwprop, simplify_permutation simplifies vec_perm_expr to view_convert_expr, and the end result becomes: svint32_t _7; __Int32x4_t _8; ;; basic block 2, loop depth 0 ;; pred: ENTRY _8 =3D {a_2(D), b_3(D), c_4(D), d_5(D)}; _7 =3D VIEW_CONVERT_EXPR<__Int32x4_t>(_8); return _7; ;; succ: EXIT which causes the error duing verify_gimple since VIEW_CONVERT_EXPR has incompatible types (svint32_t, int32x4_t). The attached patch disables simplification of VEC_PERM_EXPR in simplify_permutation, if lhs and rhs have non compatible types, which resolves ICE, but am not sure if it's the correct approach ? Alternatively, should we allow assignments from fixed-width to SVE vector, so the above VIEW_CONVERT_EXPR would result in dup ? Thanks, Prathamesh --00000000000046df0005e3a070bf Content-Type: text/plain; charset="US-ASCII"; name="ice-1.txt" Content-Disposition: attachment; filename="ice-1.txt" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l5ijfo8y0 ZGlmZiAtLWdpdCBhL2djYy90cmVlLXNzYS1mb3J3cHJvcC5jYyBiL2djYy90cmVlLXNzYS1mb3J3 cHJvcC5jYwppbmRleCA2OTU2N2FiMzI3NS4uYmU4ODhmMWM0OGUgMTAwNjQ0Ci0tLSBhL2djYy90 cmVlLXNzYS1mb3J3cHJvcC5jYworKysgYi9nY2MvdHJlZS1zc2EtZm9yd3Byb3AuY2MKQEAgLTI0 MTQsNiArMjQxNCw5IEBAIHNpbXBsaWZ5X3Blcm11dGF0aW9uIChnaW1wbGVfc3RtdF9pdGVyYXRv ciAqZ3NpKQogICBpZiAoVFJFRV9DT0RFIChvcDIpICE9IFZFQ1RPUl9DU1QpCiAgICAgcmV0dXJu IDA7CiAKKyAgaWYgKCF0eXBlc19jb21wYXRpYmxlX3AgKFRSRUVfVFlQRSAoZ2ltcGxlX2dldF9s aHMgKHN0bXQpKSwgVFJFRV9UWVBFIChvcDApKSkKKyAgICByZXR1cm4gMDsKKwogICBpZiAoVFJF RV9DT0RFIChvcDApID09IFZFQ1RPUl9DU1QpCiAgICAgewogICAgICAgY29kZSA9IFZFQ1RPUl9D U1Q7Cg== --00000000000046df0005e3a070bf--