[llvm] [RISCV] Add guard to prevent GPRPair merge on targets without Zdinx or P (PR #186600)
Sam Elliott via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 14 15:40:40 PDT 2026
lenary wrote:
Yeah, I was thinking about this when I started looking through the code again.
`isEvenRegisterCopy` and `isOddRegisterCopy` probably could have better names. Maybe `isGPRPairCopyCandidateEven` and `isGPRPairCopyCandidateOdd`? (to re-use the `Candidate` term from the `cm.mv*` instruction). I think it's fair for the `Candidate` instructions to check `ST`, like the two existing ones do.
I think we probably need to know from the first candidate for merging, what it can be merged with, before preceeding. Right now this is sort-of enforced with a bunch of `bools` and invoking very similar copies of functions, maybe that's where the confusion is coming from?
Looking at the "first" instruction, some things to note are:
- The `cm.mv*` candidates are mutually exclusive
- Even vs Odd gpr pair candidates are mutually exclusive
- It could be both a `cm.mv*` candidate and a gprpair even/odd candidate. For the moment, prioritising `cm.mv*` is correct for code size and performance.
I haven't fully understood why the `cm.mv*` candidates don't have to check for the specific order, but the GPRPair "candidates" do - maybe we're not merging `cm.mv*` pairs where the `a1` move comes before the `a0` move (I haven't checked the tests closely, recently)
https://github.com/llvm/llvm-project/pull/186600
More information about the llvm-commits
mailing list