[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
Fri Nov 4 23:48:37 PDT 2022


amyk created this revision.
amyk added reviewers: PowerPC, nemanjai, lei, stefanp.
amyk added projects: LLVM, PowerPC.
Herald added subscribers: shchenz, kbarton, hiraditya.
Herald added a project: All.
amyk requested review of this revision.
Herald added a subscriber: llvm-commits.

This patch adds the following NFC fixes to PPCInstrInfo.cpp when getting the DefMI:

- Setting the DefMI to null if the DefMI is neither an LI or and ADDI (while still being in SSA form)
- Fix documentation error to state that we want to flag a use of register between the def and the MI (in post-RA)


Repository:
  rG LLVM Github Monorepo

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
@@ -3390,7 +3390,8 @@
           // ADDI/ADDI8, we continue to find possible LI/LI8.
           if (DefMI->getOpcode() == PPC::LI || DefMI->getOpcode() == PPC::LI8)
             break;
-        }
+        } else
+          DefMI = nullptr;
       }
     }
   } else {
@@ -3423,7 +3424,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.473402.patch
Type: text/x-patch
Size: 973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221105/368e8711/attachment.bin>


More information about the llvm-commits mailing list