[llvm] [RISCV][CostModel] Add getCFInstrCost RISC-V implementation (PR #65599)

Sergey Kachkov via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 7 07:21:51 PDT 2023


================
@@ -10,7 +10,7 @@
 define ptr @zero_indices_i8(ptr %p) {
 ; CHECK-LABEL: 'zero_indices_i8'
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %x = getelementptr i8, ptr %p, i32 0
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret ptr %x
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret ptr %x
----------------
skachkov-sc wrote:

getCFInstrCost is used to get cost of PHI/Br/Ret/Switch instructions. I believe it's ok to set zero throughput cost for ret, since it will be a branch (jalr) after lowering. Regarding non-void return type: it also seems zero-cost in most cases when it's possible to coalesce return value with a0/a1 registers.

https://github.com/llvm/llvm-project/pull/65599


More information about the llvm-commits mailing list