Register re-use for scavenged frame indices must check for re-deginition
authorJim Grosbach <grosbach@apple.com>
Tue, 20 Oct 2009 16:33:57 +0000 (16:33 +0000)
committerJim Grosbach <grosbach@apple.com>
Tue, 20 Oct 2009 16:33:57 +0000 (16:33 +0000)
of the register in the instruction which kills the scavenged value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84641 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/PrologEpilogInserter.cpp

index 693bf052a2deb2698bb838c5903f1b44869a9b13..873d2372c56304633cad25f2435267a253f2deee 100644 (file)
@@ -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);