Account for early-clobber reload instructions.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Sat, 14 Jul 2012 18:45:35 +0000 (18:45 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Sat, 14 Jul 2012 18:45:35 +0000 (18:45 +0000)
No test case, there are no in-tree targets that require this.

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

lib/CodeGen/InlineSpiller.cpp

index 4c7f5d8c88c09de57cb0e5bd3fe707efa447f2bb..07e37af57f3b43e6ad312269d869b0af93221866 100644 (file)
@@ -1081,6 +1081,10 @@ void InlineSpiller::insertReload(LiveInterval &NewLI,
                            MRI.getRegClass(NewLI.reg), &TRI);
   --MI; // Point to load instruction.
   SlotIndex LoadIdx = LIS.InsertMachineInstrInMaps(MI).getRegSlot();
+  // Some (out-of-tree) targets have EC reload instructions.
+  if (MachineOperand *MO = MI->findRegisterDefOperand(NewLI.reg))
+    if (MO->isEarlyClobber())
+      LoadIdx = LoadIdx.getRegSlot(true);
   DEBUG(dbgs() << "\treload:  " << LoadIdx << '\t' << *MI);
   VNInfo *LoadVNI = NewLI.getNextValue(LoadIdx, LIS.getVNInfoAllocator());
   NewLI.addRange(LiveRange(LoadIdx, Idx, LoadVNI));