[PATCH] D91244: [GlobalISel] Add missing operand update when copy is required
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 5 13:16:10 PST 2021
arsenm added inline comments.
================
Comment at: llvm/lib/CodeGen/GlobalISel/Utils.cpp:76-84
if (GISelChangeObserver *Observer = MF.getObserver()) {
if (!RegMO.isDef()) {
MachineInstr *RegDef = MRI.getVRegDef(Reg);
Observer->changedInstr(*RegDef);
}
Observer->changingAllUsesOfReg(MRI, Reg);
Observer->finishedChangingAllUsesOfReg();
----------------
I think I misread this the first time through and thought this was replacing uses. However I'm still a bit confused.
This calls changingAllUsesOfReg after the potential change from constrainRegToClass (this will also happen even if constrainRegToClass ends up being a no-op when the register already was a compatible class). I'm further confused since the existing cases get away without calling the observer. I'm guessing this is because this is already called in contexts changing the instruction, or not bothering with the observer? If we don't need to call the observer here, I would prefer the first version but I'm unclear on whether it's really needed here at all
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91244/new/
https://reviews.llvm.org/D91244
More information about the llvm-commits
mailing list