[PATCH] D67101: Target hooks for custom COPY insertion.

Valery Pykhtin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 3 10:20:43 PDT 2019


vpykhtin added inline comments.


================
Comment at: llvm/lib/CodeGen/PHIElimination.cpp:279
+    // Give the target possiblity to handle special cases fallthrough otherwise
+    TII->createPHIDestinationCopy(MBB, AfterPHIsIt, MPhi->getDebugLoc(),
+                                  IncomingReg, DestReg);
----------------
return inserted instruction and assign iterator to it to AfterPHIsIt


================
Comment at: llvm/lib/CodeGen/PHIElimination.cpp:412
+        NewSrcInstr =
+            TII->createPHISourceCopy(opBlock, InsertPos, MPhi->getDebugLoc(),
+                                     SrcReg, SrcSubReg, IncomingReg);
----------------
returned InsertPos and NewSrcInstr is the same, use only returned value, remove reference arg from the interface.


================
Comment at: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp:6398
+void SIInstrInfo::createPHIDestinationCopy(
+    MachineBasicBlock &MBB, MachineBasicBlock::iterator &LastPHIIt,
+    const DebugLoc &DL, unsigned Src, unsigned Dst) const {
----------------
use the same name for LastPHIIt arg as in the declaration


================
Comment at: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp:6400
+    const DebugLoc &DL, unsigned Src, unsigned Dst) const {
+  MachineBasicBlock::iterator Pos = MBB.begin();
+  MachineBasicBlock::iterator Cur = LastPHIIt;
----------------
auto


================
Comment at: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp:6407
+  // assume the MBB is well formed and all the PHIs are at the top
+  while (Cur != MBB.begin() && !Cur->isPHI()) {
+    if (Cur->readsRegister(Dst)) {
----------------
search first user from the beginning of the block?


================
Comment at: llvm/lib/Target/AMDGPU/SIInstrInfo.h:957
 
+  void createPHIDestinationCopy(MachineBasicBlock &MBB,
+                                MachineBasicBlock::iterator &InsPt,
----------------
void -> MachineInstr*, remove reference to InsPt


================
Comment at: llvm/lib/Target/AMDGPU/SIInstrInfo.h:963
+  MachineInstr *createPHISourceCopy(MachineBasicBlock &MBB,
+                                    MachineBasicBlock::iterator &InsPt,
+                                    const DebugLoc &DL, unsigned Src,
----------------
remove reference from InsPt


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67101/new/

https://reviews.llvm.org/D67101





More information about the llvm-commits mailing list