From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id 4CA843858D33 for ; Thu, 9 Nov 2023 22:05:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4CA843858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4CA843858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::22f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699567532; cv=none; b=Lvmogk4SXm/37+0OHEFHqXYFq09XOy6YswR4avLNzfRPYr8WoZ2WPC8xmneisrjGhAE3t1qwIce0KqH5BnGgI06EkeUwk9hdIsGzwkAOCm1Afbrj3Z0hXa4QJeLkJBWf3NS46vPY5cdmrc9cJCwBH2Op4a5EJ+PRmbo2QNZrKRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699567532; c=relaxed/simple; bh=AKEeRVZ9PhehXvfm0NbMpKnZu/z+pMowGZ4d5LnVh9E=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=jubToMfFXBT/o5mlvWoee0xKbjSIqgEp5Ertug6rjQEFZ254Z+vZv9sc8HP52sOq0GxvpRM8F9fFxdWHTg71BomAnV5BXSm29tHR3KMY1bEeEEL5zjfWvAh3YBzW6wjIMD4jW8pu+DBSZH5WH+xqBJNMAZuDWk4YiCbxpcfJvaA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3b3e13fc1f7so822506b6e.0 for ; Thu, 09 Nov 2023 14:05:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699567529; x=1700172329; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=HU610l72zhHM/O/zpUlIjnjyfOscsjG2wUXsEsjldNU=; b=TiN32opRRkvlmhuqVvk/lYp7+HyfkccMfihGvyiXxQYynV0C+oGeGfJ2sl8PI3IQHA iudcvzKmQW2RRDwyd51ydWELAO/cO6E2RnOjh0ygsbYecNKvdi/nnk+0qVzMS9q5BMRk 615Z3wO+YZU8arS6D8Cr0QVZWGgmhSW8YZuxmSwxtYKLkLlDYb0dDCF+bC2nwN0Awch3 iBLX7jh44zGxVXFrAMH+mjHLXZ01BS9fVR281XHGoEHqn8uYn57b4wKAQSVqBG5nxm/z wI3tycFoy+BuhNp+xTE0ay9xbCulOY5IVoZlQMS2rvtDuwMkhoYQDIXghPfqmWrqFktH cX8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699567529; x=1700172329; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HU610l72zhHM/O/zpUlIjnjyfOscsjG2wUXsEsjldNU=; b=dFXsB/DBuw6H6RSW402Q8zSjeKgQWZfJb5mdGH4jn328qchQSO3pXMl0IW1cMJs1HU QbOhhfo5vd1aT+zN+NUpSB9N1QC7wPhqRbn2xTPIHO06+W8K9disjK3gcrhUOOjc0J79 tchMl/zxJjg2oMBfvpgK7LXYVzzEDZ7JlluxFqRFZQjkyXUFG3Sg5ixSScLMUq1ZxdgD W6KhkXNTVoxYl54I/uQBQb2IZ6/a6pz2Gm+sZORyGDtCMgv1iSIL3Gt+wzsNF+ujEDGS El095nGuJBD0IcNpO0b4BCZ5TZBEOo1d+jD0NHWDjBerg9t0CIA6N9KC96PagBxYQ/GV lfPw== X-Gm-Message-State: AOJu0Yx3NlP/UhsWAxhmGMRWo3ccaa0daC63aqRpobZrI0LwiFFaYTm0 sU0VOIXI/b3gy9qCQ17KcJbkOT2l6mX9kI/m8Eg= X-Google-Smtp-Source: AGHT+IF5KQZNaz0TaHCBO5SXDwLGiEWYY9i6rFC3uSiYG1K0lZsPNo2BcAGC6khrl52fotXDYpEdBdj9Xw83O4bLk3U= X-Received: by 2002:a05:6808:210a:b0:3b2:e73a:16f7 with SMTP id r10-20020a056808210a00b003b2e73a16f7mr3317099oiw.2.1699567529374; Thu, 09 Nov 2023 14:05:29 -0800 (PST) MIME-Version: 1.0 References: <20231106130145.3265828-1-maxim.a.blinov@gmail.com> <49b16edf-c2d8-4ac8-a7f4-8261f52041d6@gmail.com> In-Reply-To: <49b16edf-c2d8-4ac8-a7f4-8261f52041d6@gmail.com> From: Maxim Blinov Date: Thu, 9 Nov 2023 22:05:20 +0000 Message-ID: Subject: Re: [PATCH] RISC-V: VECT: Remember to assert any_known_not_updated_vssa To: Jeff Law Cc: gcc-patches@gcc.gnu.org, juzhe.zhong@rivai.ai, maxim.blinov@imgtec.com Content-Type: multipart/alternative; boundary="000000000000dc38520609bf6631" X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000dc38520609bf6631 Content-Type: text/plain; charset="UTF-8" Yes, those tests that triggered the ICE now pass. Maxim On Thu, 9 Nov 2023 at 16:26, Jeff Law wrote: > > > On 11/6/23 06:01, Maxim Blinov wrote: > > From: Maxim Blinov > > > > This patch is based on and intended for the > vendors/riscv/gcc-13-with-riscv-opts branch - please apply if looks OK. > > > > Fixes the following ICEs that I'm seeing: > > > > FAIL: gcc.dg/vect/O3-pr49087.c (internal compiler error: in > vect_transform_loops, at tree-vectorizer.cc:1032) > > FAIL: gcc.dg/vect/no-scevccp-pr86725-1.c (internal compiler error: in > vect_transform_loops, at tree-vectorizer.cc:1032) > > FAIL: gcc.dg/vect/no-scevccp-pr86725-2.c (internal compiler error: in > vect_transform_loops, at tree-vectorizer.cc:1032) > > FAIL: gcc.dg/vect/no-scevccp-pr86725-3.c (internal compiler error: in > vect_transform_loops, at tree-vectorizer.cc:1032) > > FAIL: gcc.dg/vect/no-scevccp-pr86725-4.c (internal compiler error: in > vect_transform_loops, at tree-vectorizer.cc:1032) > > FAIL: gcc.dg/vect/pr94443.c (internal compiler error: in > vect_transform_loops, at tree-vectorizer.cc:1032) > > FAIL: gcc.dg/vect/pr94443.c -flto -ffat-lto-objects (internal compiler > error: in vect_transform_loops, at tree-vectorizer.cc:1032) > > FAIL: gcc.dg/vect/slp-50.c (internal compiler error: in > vect_transform_loops, at tree-vectorizer.cc:1032) > > FAIL: gcc.dg/vect/slp-50.c -flto -ffat-lto-objects (internal compiler > error: in vect_transform_loops, at tree-vectorizer.cc:1032) > > FAIL: gcc.dg/vect/vect-cond-13.c (internal compiler error: in > vect_transform_loops, at tree-vectorizer.cc:1032) > > FAIL: gcc.dg/vect/vect-cond-13.c -flto -ffat-lto-objects (internal > compiler error: in vect_transform_loops, at tree-vectorizer.cc:1032) > > FAIL: gcc.dg/vect/vect-live-6.c (internal compiler error: in > vect_transform_loops, at tree-vectorizer.cc:1032) > > FAIL: gcc.dg/vect/vect-live-6.c -flto -ffat-lto-objects (internal > compiler error: in vect_transform_loops, at tree-vectorizer.cc:1032) > > FAIL: gcc.target/riscv/rvv/autovec/partial/live-1.c (internal compiler > error: in vect_transform_loops, at tree-vectorizer.cc:1032) > > FAIL: gcc.target/riscv/rvv/autovec/partial/live-2.c (internal compiler > error: in vect_transform_loops, at tree-vectorizer.cc:1032) > > > > -- >8 -- > > > > When we create a VEC_EXPAND gimple stmt: > > > > /* SCALAR_RES = VEC_EXTRACT . */ > > tree scalar_res > > = gimple_build (&stmts, CFN_VEC_EXTRACT, TREE_TYPE > (vectype), > > vec_lhs_phi, last_index); > > > > Under the hood we are really just creating a GIMPLE_CALL stmt. Later > > on, when we `gsi_insert_seq_before` our stmts: > > > > if (stmts) > > { > > gimple_stmt_iterator exit_gsi = gsi_after_labels (exit_bb); > > gsi_insert_seq_before (&exit_gsi, stmts, GSI_SAME_STMT); > > > > We eventually run into tree-ssa-operands.cc:1147: > > > > operands_scanner (fn, stmt).build_ssa_operands (); > > > > Since VEC_EXPAND is *not* marked with ECF_NOVOPS, ECF_CONST, or > > ECF_PURE flags in internal-fn.def, when > > `operand_scanner::parse_ssa_operands` comes across our > > VEC_EXTRACT-type GIMPLE_CALL, it generates a `gimple_vop()` artificial > > variable. > > > > `operand_scanner::finalize_ssa_defs` then picks this up, so our final > > stmt goes from > > > > _73 = .VEC_EXTRACT (vect_last_9.56_71, _72); > > > > to > > > > # .MEM = VDEF <> > > _73 = .VEC_EXTRACT (vect_last_9.56_71, _72); > > > > But more importantly it marks us as `ssa_renaming_needed`, in > > tree-ssa-operands.cc:420: > > > > /* If we have a non-SSA_NAME VDEF, mark it for renaming. */ > > if (gimple_vdef (stmt) > > && TREE_CODE (gimple_vdef (stmt)) != SSA_NAME) > > { > > fn->gimple_df->rename_vops = 1; > > fn->gimple_df->ssa_renaming_needed = 1; > > } > > > > This then proceeds to crash the compiler when we are about to leave > > `vect_transform_loops`: > > > > if (need_ssa_update_p (cfun)) > > { > > gcc_assert (loop_vinfo->any_known_not_updated_vssa); > > fun->gimple_df->ssa_renaming_needed = false; > > todo |= TODO_update_ssa_only_virtuals; > > } > > > > Since, > > > > - `need_ssa_update_p (cfun)` is true (it was set when we generated a > > memory vdef) > > - `loop_vinfo->any_known_not_updated_vssa` is false > > > > As the code currently stands, creating a gimple stmt containing a > > VEC_EXTRACT should always generate a memory vdef, therefore we should > > remember to mark `loop_vinfo->any_known_not_updated_vssa` afterwards. > > > > gcc/ChangeLog: > > > > * tree-vect-loop.cc (vectorizable_live_operation): Remember to > > assert loop_vinfo->any_known_not_updated_vssa if we are inserting > > a call to VEC_EXPAND. > Just to avoid any doubt -- with the internal-fn.def patch I cherry > picked earlier this week to the branch, this is no longer needed, right? > > jeff > --000000000000dc38520609bf6631--