[llvm] [RISCV][VLOPT] Add support for checkUsers when UserMI is a Single-Width Integer Reduction (PR #120345)

Michael Maitland via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 2 10:23:17 PST 2025


michaelmaitland wrote:

@preames, thanks for another look through. 

>  I'd suggest reorganizing this bit of code in terms of an accessor which gets the VL for a given use on an instruction, and then sharing all of the merge/validation logic between this codepath and the existing one. Stop trying to make the current early continue idiom work. It doesn't.

I wasn't 100% sure what you meant by `accessor which gets the VL for a given use on an instruction`, but I think I've updated this patch according to your comment here, at least my understanding of what you mean.

> You are also missing the SEW correctness check I pointed out earlier.

Now we should be using the SEW correctness by checking for compatible OperandInfo objects. There is a test in `llvm/test/CodeGen/RISCV/rvv/vl-opt-op-info.mir` (`vred_vs1_vs2_incompatible_eew`) which should demonstrate.

I've also made it so we don't unconditionally set CommonVL = One, which was incorrect.

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


More information about the llvm-commits mailing list