aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/CodeGen/PrologEpilogInserter.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp
index 693bf052a2..873d2372c5 100644
--- a/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/lib/CodeGen/PrologEpilogInserter.cpp
@@ -873,6 +873,10 @@ void PEI::scavengeFrameVirtualRegs(MachineFunction &Fn) {
PrevLastUseOp = i;
CurrentScratchReg = CurrentVirtReg = 0;
havePrevValue = trackingCurrentValue;
+ // Re-scan the operands of this instruction to catch definitions
+ // of the scratch register we're using. This is to handle things
+ // like ldr "r2, [scratch]" where scratch is r2.
+ i = 0;
}
}
RS->forward(MI);