[llvm] [RISCV] Teach RISCVInsertVSETVLI to work without LiveIntervals (PR #93796)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri May 31 11:10:49 PDT 2024


preames wrote:

I have an alternate suggestion here.  I'm going to describe this with the representation before 4b4d36654d8056546b177b3d04c352ba0b16d7ea as I think that makes things harder to understand.

My alternative basically comes down to "let ValNo be nullptr", and update uses of this value, not the definitions with some synthetic value (this patch).

getAVLDefMI is easy at is already allowed to return nullptr.  We'd need to update the doc comment, but that's about it.

getAVLVNInfo requires a bit of care.  Here's a list per callsite:
* setAVL just propagates the nullptr
* hasSameAVL can simply return false when ValNo is nullptr on either side.
* needVSETVLIPHI can simply bail out if ValNo is nullptr.
* doPRE can bailout

Each of the above is a lost *optimization* at O0, but shouldn't influence correctness.  Out of the above, the hasSameAVL is probably the biggest lost optimization, but I don't see an easy way to avoid that.  

You'd also need to reverse the order of checks involving getVNInfoFromReg, but the assert in the else shows that possible without issue.

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


More information about the llvm-commits mailing list