[llvm] [RISCV][VLOPT] Allow users that are passthrus if tail elements aren't demanded (PR #124066)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 23 10:50:17 PST 2025
lukel97 wrote:
> Hold on, this is now an unbounded recursion. This can cause both stack explosion, and more likely, significant compile time regressions.
Yeah agreed the recursion is less than ideal, but it's only unbounded by the number of passthrus that are fed into passthrus, which doesn't seem to be common in practice.
> I think you can achieve the same thing by adding a transform which uses the result of checkUsers to clear a pass thru to NoRegister. (That is, convert an instruction from TA/TU to tail undefined.) When we visit that instruction, it would propagate up.
Unfortunately there's no way to represent a tail undefined ternary pseudo, because the passthru is also the third operand. I wrote a bit more of a description of this in #123760.
I tried adding new `_INACTIVE_UNDEF` pseudos which propagate this information, but the duplication ended up causing a bunch of pain in other places, e.g. we need to handle new opcodes for commuting.
Given that we're checking the demanded VL of the users downwards, and we iterate upwards over each block, it might be possible to memoize the result of checkUsers? We would need to invalidate it whenever we reduce a VL though. I'll have a think about this tonight anyway to see if there's another approach.
https://github.com/llvm/llvm-project/pull/124066
More information about the llvm-commits
mailing list