[llvm] r268787 - [X86] Accept imp-defs of GR64 super-registers in FixupBW MOVrr.

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Fri May 6 13:03:03 PDT 2016


Author: ab
Date: Fri May  6 15:03:03 2016
New Revision: 268787

URL: http://llvm.org/viewvc/llvm-project?rev=268787&view=rev
Log:
[X86] Accept imp-defs of GR64 super-registers in FixupBW MOVrr.

Testcase will follow shortly.

Modified:
    llvm/trunk/lib/Target/X86/X86FixupBWInsts.cpp

Modified: llvm/trunk/lib/Target/X86/X86FixupBWInsts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FixupBWInsts.cpp?rev=268787&r1=268786&r2=268787&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FixupBWInsts.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FixupBWInsts.cpp Fri May  6 15:03:03 2016
@@ -248,11 +248,17 @@ MachineInstr *FixupBWInstPass::tryReplac
       BuildMI(*MF, MI->getDebugLoc(), TII->get(X86::MOV32rr), NewDestReg)
           .addReg(NewSrcReg);
 
-#ifndef NDEBUG
-  // Make sure we didn't drop any other implicit operand.
-  for (auto &Op : MI->implicit_operands())
-    assert(Op.getReg() == NewDestReg && "Copy imp-defs unrelated reg?");
-#endif
+  // Make sure we don't drop implicit operands.
+  // We used to imp-def the super, but we don't need to anymore, as we turned
+  // it into an explicit def. However, we might still need to imp-def the GR64
+  // super-register.
+  for (auto &Op : MI->implicit_operands()) {
+    if (Op.getReg() == NewDestReg && Op.isDef())
+      continue;
+    assert((!Op.isDef() || TRI->isSubRegister(Op.getReg(), NewDestReg)) &&
+           "Copy imp-defs unrelated reg?");
+    MIB.addOperand(Op);
+  }
 
   return MIB;
 }




More information about the llvm-commits mailing list