diff --git a/lib/CodeGen/UnreachableBlockElim.cpp b/lib/CodeGen/UnreachableBlockElim.cpp index ca682fd65a0..f1e3aabaebe 100644 --- a/lib/CodeGen/UnreachableBlockElim.cpp +++ b/lib/CodeGen/UnreachableBlockElim.cpp @@ -137,7 +137,8 @@ bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) { start++; phi->eraseFromParent(); - F.getRegInfo().replaceRegWith(Output, Input); + if (Input != Output) + F.getRegInfo().replaceRegWith(Output, Input); } else start++; }