[PATCH] D113784: [AMDGPU][GlobalISel] Try to rematerialize when repairing regbank
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 30 08:29:55 PDT 2022
arsenm added a comment.
Herald added a subscriber: kosarev.
Herald added a project: All.
I'm currently thinking rematerialized in regbankselect is a good strategy. We would still want to have a post-isel operand optimizer pass try to re-scalarize constants when there's open constant bus use.
================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h:631
+ /// instead of repairing it by inserting copies.
+ virtual bool canRematerialize(Register Reg,
+ const MachineRegisterInfo &MRI) const {
----------------
It would be better to report the rematerializability of an opcode as part of the reported mapping rather than add another callback for it
================
Comment at: llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp:166-170
+ if (RBI->canRematerialize(Src, *MRI)) {
+ MachineInstr *SrcMI = MRI->getVRegDef(Src);
+ MI = SrcMI->getMF()->CloneMachineInstr(SrcMI);
+ MI->getOperand(0).setReg(Dst);
+ LLVM_DEBUG(dbgs() << "Clone with new regbank: " << *SrcMI << '\n');
----------------
I think it would be cleaner to handle this as a separate RepairingPlacement case in applyMapping
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113784/new/
https://reviews.llvm.org/D113784
More information about the llvm-commits
mailing list