[Committed] RISC-V: Use safe_grow_cleared for vector info [PR111469]

Message ID da3d1e8c-3df2-2008-ad14-a3036b6f6665@rivosinc.com
State Not Applicable
Headers
Series [Committed] RISC-V: Use safe_grow_cleared for vector info [PR111469] |

Checks

Context Check Description
snail/gcc-patch-check fail Git am fail log

Commit Message

Patrick O'Neill Sept. 30, 2023, 11:13 p.m. UTC
  Committed. Thanks Juzhe!

I had to adjust the changelog's PR formatting to get the pre-commit 
hooks to accept it.
Here's the committed patch:

 From f446cf5d58568e406cc81f434a63b3045942e9a9 Mon Sep 17 00:00:00 2001
From: Patrick O'Neill <patrick@rivosinc.com>
Date: Sat, 30 Sep 2023 15:50:11 -0700
Subject: [PATCH] RISC-V: Use safe_grow_cleared for vector info [PR111649]

Resolves a riscv*-*-* bootstrap failure due to a newly-turned-on assert.

2023-09-30  Jakub Jelinek <jakub@redhat.com>

gcc/ChangeLog:

     PR target/111649

     * config/riscv/riscv-vsetvl.cc 
(vector_infos_manager::vector_infos_manager):
     Replace safe_grow with safe_grow_cleared.
---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111649

Fix authored by Jakub Jelinek.

Tested for regressions using multilib riscv glibc rv32gcv, rv64gcv
---
  gcc/config/riscv/riscv-vsetvl.cc | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

--
2.34.1

On 9/30/23 16:03, 钟居哲 wrote:
> LGTM.
>
> ------------------------------------------------------------------------
> juzhe.zhong@rivai.ai
>
>     *From:* Patrick O'Neill <mailto:patrick@rivosinc.com>
>     *Date:* 2023-10-01 07:00
>     *To:* gcc-patches <mailto:gcc-patches@gcc.gnu.org>; juzhe.zhong
>     <mailto:juzhe.zhong@rivai.ai>
>     *CC:* jakub <mailto:jakub@redhat.com>; pinskia
>     <mailto:pinskia@gcc.gnu.org>; JeffreyALaw
>     <mailto:JeffreyALaw@gmail.com>; gnu-toolchain
>     <mailto:gnu-toolchain@rivosinc.com>; Patrick O'Neill
>     <mailto:patrick@rivosinc.com>
>     *Subject:* [PATCH] RISC-V: Use safe_grow_cleared for vector info
>     [PR111469]
>     Resolves a riscv*-*-* bootstrap failure due to a newly-turned-on
>     assert.
>     2023-09-30  Jakub Jelinek <jakub@redhat.com>
>     PR target/111649
>     gcc/ChangeLog:
>     * config/riscv/riscv-vsetvl.cc
>     (vector_infos_manager::vector_infos_manager):
>     Replace safe_grow with safe_grow_cleared.
>     ---
>     https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111649
>     Fix authored by Jakub Jelinek.
>     Tested for regressions using multilib riscv glibc rv32gcv, rv64gcv
>     ---
>     gcc/config/riscv/riscv-vsetvl.cc | 4 ++--
>     1 file changed, 2 insertions(+), 2 deletions(-)
>     diff --git a/gcc/config/riscv/riscv-vsetvl.cc
>     b/gcc/config/riscv/riscv-vsetvl.cc
>     index af8c31d873c..4b06d93e7f9 100644
>     --- a/gcc/config/riscv/riscv-vsetvl.cc
>     +++ b/gcc/config/riscv/riscv-vsetvl.cc
>     @@ -2417,8 +2417,8 @@ vector_infos_manager::vector_infos_manager ()
>        vector_antin = nullptr;
>        vector_antout = nullptr;
>        vector_earliest = nullptr;
>     -  vector_insn_infos.safe_grow (get_max_uid ());
>     -  vector_block_infos.safe_grow (last_basic_block_for_fn (cfun));
>     +  vector_insn_infos.safe_grow_cleared (get_max_uid ());
>     +  vector_block_infos.safe_grow_cleared (last_basic_block_for_fn
>     (cfun));
>        if (!optimize)
>          {
>            basic_block cfg_bb;
>     --
>     2.34.1
>
  

Patch

diff --git a/gcc/config/riscv/riscv-vsetvl.cc 
b/gcc/config/riscv/riscv-vsetvl.cc
index af8c31d873c..4b06d93e7f9 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -2417,8 +2417,8 @@  vector_infos_manager::vector_infos_manager ()
    vector_antin = nullptr;
    vector_antout = nullptr;
    vector_earliest = nullptr;
-  vector_insn_infos.safe_grow (get_max_uid ());
-  vector_block_infos.safe_grow (last_basic_block_for_fn (cfun));
+  vector_insn_infos.safe_grow_cleared (get_max_uid ());
+  vector_block_infos.safe_grow_cleared (last_basic_block_for_fn (cfun));
    if (!optimize)
      {
        basic_block cfg_bb;