[llvm] cd2a73a - [MCP] Add stats for backward copy propagation. NFC.

Kai Luo via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 30 00:51:49 PST 2019


Author: Kai Luo
Date: 2019-12-30T16:48:28+08:00
New Revision: cd2a73a9f01b2ec1b7e239ba83201199df0d7912

URL: https://github.com/llvm/llvm-project/commit/cd2a73a9f01b2ec1b7e239ba83201199df0d7912
DIFF: https://github.com/llvm/llvm-project/commit/cd2a73a9f01b2ec1b7e239ba83201199df0d7912.diff

LOG: [MCP] Add stats for backward copy propagation. NFC.

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineCopyPropagation.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
index 6db388c2564a..c316b167059b 100644
--- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -78,6 +78,7 @@ using namespace llvm;
 
 STATISTIC(NumDeletes, "Number of dead copies deleted");
 STATISTIC(NumCopyForwards, "Number of copy uses forwarded");
+STATISTIC(NumCopyBackwardPropagated, "Number of copy defs backward propagated");
 DEBUG_COUNTER(FwdCounter, "machine-cp-fwd",
               "Controls which register COPYs are forwarded");
 
@@ -793,6 +794,7 @@ void MachineCopyPropagation::propagateDefs(MachineInstr &MI) {
     LLVM_DEBUG(dbgs() << "MCP: After replacement: " << MI << "\n");
     MaybeDeadCopies.insert(Copy);
     Changed = true;
+    ++NumCopyBackwardPropagated;
   }
 }
 
@@ -849,8 +851,10 @@ void MachineCopyPropagation::BackwardCopyPropagateBlock(
     }
   }
 
-  for (auto *Copy : MaybeDeadCopies)
+  for (auto *Copy : MaybeDeadCopies) {
     Copy->eraseFromParent();
+    ++NumDeletes;
+  }
 
   MaybeDeadCopies.clear();
   CopyDbgUsers.clear();


        


More information about the llvm-commits mailing list