[PATCH] D61671: X86WinAllocaExpander: Drop code looking through register copies (PR41786)

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 02:20:44 PDT 2019


This revision was automatically updated to reflect the committed changes.
hans marked an inline comment as done.
Closed by commit rL360320: X86WinAllocaExpander: Drop code looking through register copies (PR41786) (authored by hans, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61671?vs=198624&id=198776#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61671

Files:
  llvm/trunk/lib/Target/X86/X86WinAllocaExpander.cpp


Index: llvm/trunk/lib/Target/X86/X86WinAllocaExpander.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86WinAllocaExpander.cpp
+++ llvm/trunk/lib/Target/X86/X86WinAllocaExpander.cpp
@@ -84,10 +84,6 @@
   unsigned AmountReg = MI->getOperand(0).getReg();
   MachineInstr *Def = MRI->getUniqueVRegDef(AmountReg);
 
-  // Look through copies.
-  while (Def && Def->isCopy() && Def->getOperand(1).isReg())
-    Def = MRI->getUniqueVRegDef(Def->getOperand(1).getReg());
-
   if (!Def ||
       (Def->getOpcode() != X86::MOV32ri && Def->getOpcode() != X86::MOV64ri) ||
       !Def->getOperand(1).isImm())
@@ -268,18 +264,10 @@
   unsigned AmountReg = MI->getOperand(0).getReg();
   MI->eraseFromParent();
 
-  // Delete the definition of AmountReg, possibly walking a chain of copies.
-  for (;;) {
-    if (!MRI->use_empty(AmountReg))
-      break;
-    MachineInstr *AmountDef = MRI->getUniqueVRegDef(AmountReg);
-    if (!AmountDef)
-      break;
-    if (AmountDef->isCopy() && AmountDef->getOperand(1).isReg())
-      AmountReg = AmountDef->getOperand(1).isReg();
-    AmountDef->eraseFromParent();
-    break;
-  }
+  // Delete the definition of AmountReg.
+  if (MRI->use_empty(AmountReg))
+    if (MachineInstr *AmountDef = MRI->getUniqueVRegDef(AmountReg))
+      AmountDef->eraseFromParent();
 }
 
 bool X86WinAllocaExpander::runOnMachineFunction(MachineFunction &MF) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61671.198776.patch
Type: text/x-patch
Size: 1427 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190509/996850da/attachment.bin>


More information about the llvm-commits mailing list