[PATCH] D108731: [TwoAddressInstructionPass] Improve the SrcRegMap and DstRegMap computation
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 17 20:47:01 PDT 2021
craig.topper added inline comments.
================
Comment at: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:400
+ if (UseMI.isCommutable()) {
+ unsigned Src1 = TII->CommuteAnyOperandIndex;
+ unsigned Src2 = UseMI.findRegisterUseOperandIdx(Reg);
----------------
Use `TargetInstrInfo::CommuteAnyOperandIndex` so this doesn't look like a member access?
================
Comment at: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:436
+ Register Reg;
+ if (MO.isReg())
+ Reg = MO.getReg();
----------------
Why not check isReg() inside the loop and call getReg() in the loop. That wouldn't be that expensive would it?
================
Comment at: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:661
- if (!isNew)
- assert(SrcRegMap[NewReg] == Reg && "Can't map to two src registers!");
VirtRegPairs.push_back(NewReg);
----------------
Is this assert no longer valid?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108731/new/
https://reviews.llvm.org/D108731
More information about the llvm-commits
mailing list