[PATCH] D149169: [RISCV] Cost constant materialization of vectors in phis

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 10:24:19 PDT 2023


luke added inline comments.


================
Comment at: llvm/test/Analysis/CostModel/RISCV/rvv-phi-const.ll:8
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: br label %d
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %x = phi <2 x i8> [ <i8 1, i8 -1>, %a ], [ <i8 -1, i8 1>, %b ]
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = phi <2 x i8> [ <i8 1, i8 -1>, %a ], [ <i8 -1, i8 1>, %b ]
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i8> %x
----------------
The generated code:
```
f:                                      # @f
	.cfi_startproc
# %bb.0:
	vsetivli	zero, 2, e8, mf8, ta, ma
	vid.v	v8
	andi	a0, a0, 1
	vadd.vv	v8, v8, v8
	beqz	a0, .LBB0_2
# %bb.1:
	vrsub.vi	v8, v8, 1
	ret
.LBB0_2:                                # %b
	vadd.vi	v8, v8, -1
	ret
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149169/new/

https://reviews.llvm.org/D149169



More information about the llvm-commits mailing list