diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp --- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -1486,9 +1486,10 @@ } if (AllUsesCopied) { - bool ReplacedAllUntiedUses = true; + bool ReplacedAllUntiedUses = false; if (!IsEarlyClobber) { // Replace other (un-tied) uses of regB with LastCopiedReg. + ReplacedAllUntiedUses = true; for (MachineOperand &MO : MI->operands()) { if (MO.isReg() && MO.getReg() == RegB && MO.isUse()) { if (MO.getSubReg() == SubRegB) {