[llvm] [VPlan] Move tail folding out of VPlanPredicator. NFC (PR #176143)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 22 02:57:46 PST 2026
lukel97 wrote:
I tried reworking this PR and https://github.com/llvm/llvm-project/pull/172454 to use VPInstruction mask operands from https://github.com/llvm/llvm-project/pull/142285, but it turned out to be very difficult since you need to merge the mask operands during both tail folding, early exits and linearization.
Not only do you have to worry about where to insert logical-ands and deduplicating them, the big issue I found is that if you e.g. want to predicate everything past the exiting block here, you have to start dealing with control flow joins:
```mermaid
flowchart
foo --> exiting --> bar
foo --> bar
```
And in that case you end up reimplementing what VPPredicator already does.
> Given that we now need to pass the extra state between transforms, I am wondering if it still helps for https://github.com/llvm/llvm-project/pull/172454? That would then also require passing more state between transforms further appart, right?
I've removed the state in 81332b3fa28e95819fe9d67310a45409b15a833e, and instead used a new VPInstruction to indicate to VPPredicator that the successors should be predicated.
I was able to reuse this approach for #172454 too, and it works after rebasing on top of #142285.
https://github.com/llvm/llvm-project/pull/176143
More information about the llvm-commits
mailing list