diff mbox series

RISC-V: Fix bug of before_p function

Message ID 20230118030921.69098-1-juzhe.zhong@rivai.ai
State New
Headers show
Series RISC-V: Fix bug of before_p function | expand

Commit Message

juzhe.zhong@rivai.ai Jan. 18, 2023, 3:09 a.m. UTC
From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>

gcc/ChangeLog:

        * config/riscv/riscv-vsetvl.cc (before_p): Fix bug.

---
 gcc/config/riscv/riscv-vsetvl.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kito Cheng Jan. 27, 2023, 10:09 a.m. UTC | #1
Committed with more comments to describe why this should be fixed.

On Wed, Jan 18, 2023 at 11:10 AM <juzhe.zhong@rivai.ai> wrote:

> From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
>
> gcc/ChangeLog:
>
>         * config/riscv/riscv-vsetvl.cc (before_p): Fix bug.
>
> ---
>  gcc/config/riscv/riscv-vsetvl.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/config/riscv/riscv-vsetvl.cc
> b/gcc/config/riscv/riscv-vsetvl.cc
> index 26d096ea939..728a32dacd6 100644
> --- a/gcc/config/riscv/riscv-vsetvl.cc
> +++ b/gcc/config/riscv/riscv-vsetvl.cc
> @@ -188,7 +188,7 @@ real_insn_and_same_bb_p (const insn_info *insn, const
> bb_info *bb)
>  static bool
>  before_p (const insn_info *insn1, const insn_info *insn2)
>  {
> -  return insn1->compare_with (insn2) == -1;
> +  return insn1->compare_with (insn2) < 0;
>  }
>
>  static bool
> --
> 2.36.3
>
>
diff mbox series

Patch

diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 26d096ea939..728a32dacd6 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -188,7 +188,7 @@  real_insn_and_same_bb_p (const insn_info *insn, const bb_info *bb)
 static bool
 before_p (const insn_info *insn1, const insn_info *insn2)
 {
-  return insn1->compare_with (insn2) == -1;
+  return insn1->compare_with (insn2) < 0;
 }
 
 static bool