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

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 04:38:38 PDT 2019


hans updated this revision to Diff 198624.
hans marked 2 inline comments as done.

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

https://reviews.llvm.org/D61671

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


Index: llvm/lib/Target/X86/X86WinAllocaExpander.cpp
===================================================================
--- llvm/lib/Target/X86/X86WinAllocaExpander.cpp
+++ llvm/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,17 +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();
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61671.198624.patch
Type: text/x-patch
Size: 1339 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190508/c0816dc2/attachment.bin>


More information about the llvm-commits mailing list