[PATCH] D82988: [RISCV] Avoid Splitting MBB in RISCVExpandPseudo
Luís Marques via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 6 14:26:50 PDT 2020
luismarques accepted this revision.
luismarques added a comment.
This revision is now accepted and ready to land.
LGTM. Nice!
================
Comment at: llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp:74-76
MachineBasicBlock::iterator NMBBI = std::next(MBBI);
- Modified |= expandMI(MBB, MBBI, NMBBI);
+ Modified |= expandMI(MBB, MBBI);
MBBI = NMBBI;
----------------
lenary wrote:
> Oh this loop can be simplifed - though I'm not sure I should be incrementing `MBBI` if we've inserted new instructions using `BuildMI`, which I think also increments the iterator automatically. Guidance here would be helpful.
Maybe I misunderstood your issue, but I think the increment is correct:
1) It is what AArch64 does.
2) If you have two consecutive pseudo-instructions this code expands them both, so you aren't skipping over the second by performing the explicit increment.
3) You don't want to iterate over the expanded instructions, to recursively expand them, since we don't emit other pseudo-instructions in the expansions.
BTW, what simplification were you considering for this loop?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82988/new/
https://reviews.llvm.org/D82988
More information about the llvm-commits
mailing list