[PATCH] D138757: [zero-call-used-regs] Mark only non-debug instruction's register as used

Shivam Gupta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 21:18:45 PST 2022


xgupta updated this revision to Diff 478451.
xgupta added a comment.

address comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138757

Files:
  llvm/lib/CodeGen/PrologEpilogInserter.cpp


Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
===================================================================
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -1229,7 +1229,11 @@
   BitVector UsedRegs(TRI.getNumRegs());
   if (OnlyUsed)
     for (const MachineBasicBlock &MBB : MF)
-      for (const MachineInstr &MI : MBB)
+      for (const MachineInstr &MI : MBB) {
+        // skip debug instructions
+        if (MI.isDebugInstr())
+          continue;
+
         for (const MachineOperand &MO : MI.operands()) {
           if (!MO.isReg())
             continue;
@@ -1239,6 +1243,7 @@
               (MO.isDef() || MO.isUse()))
             UsedRegs.set(Reg);
         }
+      }
 
   // Get a list of registers that are used.
   BitVector LiveIns(TRI.getNumRegs());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138757.478451.patch
Type: text/x-patch
Size: 825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221129/27be059d/attachment.bin>


More information about the llvm-commits mailing list