[llvm] [RISCV][VLOPT] Compute demanded VLs up front. NFC (PR #124530)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 08:21:44 PST 2025


https://github.com/preames requested changes to this pull request.

A couple of high level points here:
1) This is not NFC - as pointed out by your own test changes.
2) I am really not a fan of the API change to remove std::optional<MachineOperand>, and it's not clear why you're doing this?  You can have a DenseMap with an optional as a value?
3) The initial demanded VL is sound, but not precise.  As you reduce a transitive user, you can reduce the VL of an instruction which in turn reduces it of that instructions defs.  You backward walk achieves this within a basic block, but we loose the cross block case.
4) Per (3) you do need to invalidate.  Alternatively, you could adapt the worklist scheme during the computation.
5) Given (4) - the worklist variant - I'd probably write this as memo-ization, not upfront computation.  I'd guess (not having tried to actual write it), that the code structure would be cleaner.  

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


More information about the llvm-commits mailing list