[llvm] [RISCV] Support postRA vsetvl insertion pass (PR #70549)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 22:23:41 PDT 2024


================
@@ -46,13 +46,12 @@ define <16 x i8> @trn1.v16i8(<16 x i8> %v0, <16 x i8> %v1) {
 define <16 x i8> @trn2.v16i8(<16 x i8> %v0, <16 x i8> %v1) {
 ; CHECK-LABEL: trn2.v16i8:
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    vsetivli zero, 16, e8, m1, ta, ma
-; CHECK-NEXT:    vslidedown.vi v8, v8, 1
 ; CHECK-NEXT:    lui a0, 11
 ; CHECK-NEXT:    addi a0, a0, -1366
-; CHECK-NEXT:    vsetvli zero, zero, e16, m2, ta, ma
+; CHECK-NEXT:    vsetivli zero, 1, e16, m1, ta, ma
----------------
lukel97 wrote:

It looks like we're actually removing a vsetvli overall here.

Although we could go a step further and teach the doLocalPostpass to change the AVL and LMUL in this case to avoid a toggle:

```
vsetivli zero, 16, e16, m2, ta, ma
vmv.s.x v0, a0
vsetvli zero, zero, e8, m1, ta, ma
vslidedown.vi v8, v8, 1
```

This isn't something that it was able to do before, since doLocalPostpass will only mutate vsetlvis if it can remove a vsetvli entirely.

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


More information about the llvm-commits mailing list