summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MIRPrinter.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2019-02-22 19:30:38 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2019-02-22 19:30:38 +0000
commit7b55066a3485103a1ad4a7b316c1bd383156c223 (patch)
treec83da6674d30c82e12f9e9398ea6302f339836df /llvm/lib/CodeGen/MIRPrinter.cpp
parent6d05d6a7b62f4b9f42261e5239e2a97d6069344b (diff)
downloadbcm5719-llvm-7b55066a3485103a1ad4a7b316c1bd383156c223.tar.gz
bcm5719-llvm-7b55066a3485103a1ad4a7b316c1bd383156c223.zip
MIR: Preserve incoming frame index numbers
Don't skip incrementing the frame index number if the object is dead. Instructions can still be referencing the old frame index number, and this doesn't attempt to remap those. The resulting MIR then fails to load because the use instructions use a higher frame index number than recorded list of stack objects. I'm not sure it's possible to craft a testcase with the existing set of passes. It requires selectively marking some stack objects dead in an essentially random order. StackSlotColoring condenses towards the low indexes. This avoids a regression in a future AMDGPU commit when some frame indexes are lowered separately from PEI. llvm-svn: 354688
Diffstat (limited to 'llvm/lib/CodeGen/MIRPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/MIRPrinter.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp
index 79392569a79..5977ba467ac 100644
--- a/llvm/lib/CodeGen/MIRPrinter.cpp
+++ b/llvm/lib/CodeGen/MIRPrinter.cpp
@@ -351,7 +351,7 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &YMF,
const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
// Process fixed stack objects.
unsigned ID = 0;
- for (int I = MFI.getObjectIndexBegin(); I < 0; ++I) {
+ for (int I = MFI.getObjectIndexBegin(); I < 0; ++I, ++ID) {
if (MFI.isDeadObjectIndex(I))
continue;
@@ -368,12 +368,12 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &YMF,
YamlObject.IsAliased = MFI.isAliasedObjectIndex(I);
YMF.FixedStackObjects.push_back(YamlObject);
StackObjectOperandMapping.insert(
- std::make_pair(I, FrameIndexOperand::createFixed(ID++)));
+ std::make_pair(I, FrameIndexOperand::createFixed(ID)));
}
// Process ordinary stack objects.
ID = 0;
- for (int I = 0, E = MFI.getObjectIndexEnd(); I < E; ++I) {
+ for (int I = 0, E = MFI.getObjectIndexEnd(); I < E; ++I, ++ID) {
if (MFI.isDeadObjectIndex(I))
continue;
@@ -394,7 +394,7 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &YMF,
YMF.StackObjects.push_back(YamlObject);
StackObjectOperandMapping.insert(std::make_pair(
- I, FrameIndexOperand::create(YamlObject.Name.Value, ID++)));
+ I, FrameIndexOperand::create(YamlObject.Name.Value, ID)));
}
for (const auto &CSInfo : MFI.getCalleeSavedInfo()) {
OpenPOWER on IntegriCloud