aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/LowerSubregs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/LowerSubregs.cpp')
-rw-r--r--lib/CodeGen/LowerSubregs.cpp9
1 files changed, 6 insertions, 3 deletions
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 @@ bool LowerSubregsInstructionPass::LowerInsert(MachineInstr *MI) {
// 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);