]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Fix bug of before_p function
authorJu-Zhe Zhong <juzhe.zhong@rivai.ai>
Wed, 18 Jan 2023 03:09:21 +0000 (11:09 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Fri, 27 Jan 2023 10:08:58 +0000 (18:08 +0800)
compare_with will return other than -1, so it should check less than 0
rather than check exactly with -1.

gcc/ChangeLog:

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

gcc/config/riscv/riscv-vsetvl.cc

index 45e14d0ff0351e782d3cfc0b38b60fae0c488b1e..a18ccd72ab6202c8b9f7dcbb44456765d25ee405 100644 (file)
@@ -187,7 +187,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