[llvm] [LV] Unconditionally run materializeConstVTC in ::executePlan (PR #191299)

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 12 22:09:47 PDT 2026


asb wrote:

This caused a regression for one of the rv32 vector configs -  rv32gc_zve32f_zvl128b, causing the following failures:

```
Failed Tests (4):
  test-suite :: SingleSource/UnitTests/Vectorizer/tf-early-exit.test
  test-suite :: SingleSource/UnitTests/Vectorizer/tf-ftic-early-exit.test
  test-suite :: SingleSource/UnitTests/Vectorizer/tfactivelanemask-early-exit.test
  test-suite :: SingleSource/UnitTests/Vectorizer/tfactivelanemask-ftic-early-exit.test
```

I have the following reproducer:

```llvm
target triple = "riscv32-unknown-linux-gnu"

define void @init(ptr %A, ptr %B) {
entry:
  br label %loop

loop:
  %i = phi i32 [ 0, %entry ], [ %inc, %loop ]
  %p = getelementptr i32, ptr %A, i32 %i
  store i32 %i, ptr %p
  %v = add i32 %i, 17
  %q = getelementptr i32, ptr %B, i32 %i
  store i32 %v, ptr %q
  %inc = add i32 %i, 1
  %done = icmp eq i32 %inc, 17
  br i1 %done, label %exit, label %loop

exit:
  ret void
}
```

And then invoke:

```sh
/path/to/opt -S -passes=loop-vectorize \
    -mtriple=riscv32-linux-gnu \
    -mattr=+m,+a,+f,+d,+c,+zicsr,+zifencei,+zve32f,+zvl128b \
    -scalable-vectorization=off \
    -prefer-predicate-over-epilogue=predicate-dont-vectorize \
    -force-tail-folding-style=data-without-lane-mask \
    tc.ll
```

Without this patch, the exit condition for `vector.body` is `  %5 = icmp eq i32 %index.next, 20`. With this patch, the exit condition becomes ` %5 = icmp eq i32 %index.next, 16`.

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


More information about the llvm-commits mailing list