[PATCH] D137483: [NFC][PowerPC] Add NFC fixes to PPCInstrinfo.cpp when getting the defined machine instruction.
Amy Kwan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 6 12:24:25 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG48634b3b935f: [NFC][PowerPC] Add NFC fixes to PPCInstrinfo.cpp when getting the defined… (authored by amyk).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137483/new/
https://reviews.llvm.org/D137483
Files:
llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
Index: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -3380,11 +3380,13 @@
continue;
Register TrueReg = TRI->lookThruCopyLike(Reg, MRI);
if (Register::isVirtualRegister(TrueReg)) {
- DefMI = MRI->getVRegDef(TrueReg);
- if (DefMI->getOpcode() == PPC::LI || DefMI->getOpcode() == PPC::LI8 ||
- DefMI->getOpcode() == PPC::ADDI ||
- DefMI->getOpcode() == PPC::ADDI8) {
+ MachineInstr *DefMIForTrueReg = MRI->getVRegDef(TrueReg);
+ if (DefMIForTrueReg->getOpcode() == PPC::LI ||
+ DefMIForTrueReg->getOpcode() == PPC::LI8 ||
+ DefMIForTrueReg->getOpcode() == PPC::ADDI ||
+ DefMIForTrueReg->getOpcode() == PPC::ADDI8) {
OpNoForForwarding = i;
+ DefMI = DefMIForTrueReg;
// The ADDI and LI operand maybe exist in one instruction at same
// time. we prefer to fold LI operand as LI only has one Imm operand
// and is more possible to be converted. So if current DefMI is
@@ -3424,7 +3426,7 @@
if (MO.isReg() && MO.isUse() && !MO.isImplicit()) {
Register Reg = MI.getOperand(i).getReg();
// If we see another use of this reg between the def and the MI,
- // we want to flat it so the def isn't deleted.
+ // we want to flag it so the def isn't deleted.
MachineInstr *DefMI = getDefMIPostRA(Reg, MI, SeenIntermediateUse);
if (DefMI) {
// Is this register defined by some form of add-immediate (including
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137483.480578.patch
Type: text/x-patch
Size: 1677 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221206/230b605f/attachment.bin>
More information about the llvm-commits
mailing list