One more place where subreg lowering forgot to transfer undefness.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78144 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/LowerSubregs.cpp b/lib/CodeGen/LowerSubregs.cpp
index e9e60a0..358aa16 100644
--- a/lib/CodeGen/LowerSubregs.cpp
+++ b/lib/CodeGen/LowerSubregs.cpp
@@ -242,9 +242,12 @@
     // No need to insert an identity copy instruction. If the SrcReg was
     // <undef>, we need to make sure it is alive by inserting an IMPLICIT_DEF
     if (MI->getOperand(1).isUndef() && !MI->getOperand(0).isDead()) {
-      BuildMI(*MBB, MI, MI->getDebugLoc(),
-              TII.get(TargetInstrInfo::IMPLICIT_DEF), DstReg)
-        .addReg(InsReg, RegState::ImplicitKill);
+      MachineInstrBuilder MIB = BuildMI(*MBB, MI, MI->getDebugLoc(),
+                                TII.get(TargetInstrInfo::IMPLICIT_DEF), DstReg);
+      if (MI->getOperand(2).isUndef())
+        MIB.addReg(InsReg, RegState::Implicit | RegState::Undef);
+      else
+        MIB.addReg(InsReg, RegState::ImplicitKill);
     } else {
       DOUT << "subreg: eliminated!\n";
       MBB->erase(MI);