Skip to content

Commit

Permalink
[RegScavenger][NFC] Refer to the already initialized local variable f…
Browse files Browse the repository at this point in the history
…or spill slot index

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D109501
  • Loading branch information
RamNalamothu committed Sep 13, 2021
1 parent 181d18e commit 726b5d3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions llvm/lib/CodeGen/RegisterScavenging.cpp
Expand Up @@ -500,16 +500,14 @@ RegScavenger::spill(Register Reg, const TargetRegisterClass &RC, int SPAdj,
": Cannot scavenge register without an emergency spill slot!";
report_fatal_error(Msg.c_str());
}
TII->storeRegToStackSlot(*MBB, Before, Reg, true, Scavenged[SI].FrameIndex,
&RC, TRI);
TII->storeRegToStackSlot(*MBB, Before, Reg, true, FI, &RC, TRI);
MachineBasicBlock::iterator II = std::prev(Before);

unsigned FIOperandNum = getFrameIndexOperandNum(*II);
TRI->eliminateFrameIndex(II, SPAdj, FIOperandNum, this);

// Restore the scavenged register before its use (or first terminator).
TII->loadRegFromStackSlot(*MBB, UseMI, Reg, Scavenged[SI].FrameIndex,
&RC, TRI);
TII->loadRegFromStackSlot(*MBB, UseMI, Reg, FI, &RC, TRI);
II = std::prev(UseMI);

FIOperandNum = getFrameIndexOperandNum(*II);
Expand Down

0 comments on commit 726b5d3

Please sign in to comment.