[PATCH] D128588: [AVR] Fix expanding MOVW for overlapping registers
Ben Shi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 25 20:43:10 PDT 2022
benshi001 added inline comments.
================
Comment at: llvm/lib/Target/AVR/AVRInstrInfo.cpp:61
- // Copy each individual register with the `MOV` instruction.
- BuildMI(MBB, MI, DL, get(AVR::MOVRdRr), DestLo)
- .addReg(SrcLo, getKillRegState(KillSrc));
- BuildMI(MBB, MI, DL, get(AVR::MOVRdRr), DestHi)
- .addReg(SrcHi, getKillRegState(KillSrc));
+ bool CopyHasOverlappingRegs = DestLo == SrcHi;
+
----------------
Using name `CopyHasOverlappingRegs` maybe confusing, for the case `DestHi == SrcLow`. Though there is overlapping for `r25r24 -> r24r23`, we have to still copy lower byte first.
So I suggest
```
if (DestLo == SrcHi) {
...
} else {
...
}
```
And the long comment is unnecessary, since the logic is clear enough to understand.
================
Comment at: llvm/test/CodeGen/AVR/pseudo/COPY.mir:31
+ $r23r22 = COPY $r25r24
+ RCALLk @foo, implicit $sp, implicit killed $r24r23
+...
----------------
Are these two `implicit killed` in the two RCALLk necessary ?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128588/new/
https://reviews.llvm.org/D128588
More information about the llvm-commits
mailing list