diff mbox series

RISC-V: Fix loop invariant check

Message ID 20240109012453.675353-1-juzhe.zhong@rivai.ai
State New
Headers show
Series RISC-V: Fix loop invariant check | expand

Commit Message

钟居哲 Jan. 9, 2024, 1:24 a.m. UTC
As Robin suggested, remove gimple_uid check which is sufficient for our need.

Tested on both RV32/RV64 no regression, ok for trunk ?

gcc/ChangeLog:

	* config/riscv/riscv-vector-costs.cc (loop_invariant_op_p): Fix loop invariant check.

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

Comments

Robin Dapp Jan. 9, 2024, 9:39 a.m. UTC | #1
OK.  I'm still a bit unsure about whether SSA_NAME_IS_DEFAULT_DEF
can really occur but if it does it's not wrong to treat it as
loop invariant.

Regards
 Robin
diff mbox series

Patch

diff --git a/gcc/config/riscv/riscv-vector-costs.cc b/gcc/config/riscv/riscv-vector-costs.cc
index 3bae581d6fd..f4a1a789f23 100644
--- a/gcc/config/riscv/riscv-vector-costs.cc
+++ b/gcc/config/riscv/riscv-vector-costs.cc
@@ -241,7 +241,7 @@  loop_invariant_op_p (class loop *loop,
   if (SSA_NAME_IS_DEFAULT_DEF (op)
       || !flow_bb_inside_loop_p (loop, gimple_bb (SSA_NAME_DEF_STMT (op))))
     return true;
-  return gimple_uid (SSA_NAME_DEF_STMT (op)) & 1;
+  return false;
 }
 
 /* Return true if the variable should be counted into liveness.  */