[llvm] e38018b - [MIR] Fix a bug in MIR printer.
Michael Liao via llvm-commits
llvm-commits at lists.llvm.org
Wed May 6 07:33:56 PDT 2020
Author: Michael Liao
Date: 2020-05-06T10:33:45-04:00
New Revision: e38018b80d8e60206268740c688236734dea7b86
URL: https://github.com/llvm/llvm-project/commit/e38018b80d8e60206268740c688236734dea7b86
DIFF: https://github.com/llvm/llvm-project/commit/e38018b80d8e60206268740c688236734dea7b86.diff
LOG: [MIR] Fix a bug in MIR printer.
- Need to skip the assignment of `ID`, which is used to index that two
object arrays.
Added:
Modified:
llvm/lib/CodeGen/MIRPrinter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp
index 5e01af25bdd8..973bf3c06fcb 100644
--- a/llvm/lib/CodeGen/MIRPrinter.cpp
+++ b/llvm/lib/CodeGen/MIRPrinter.cpp
@@ -365,7 +365,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, ++ID) {
+ for (int I = MFI.getObjectIndexBegin(); I < 0; ++I) {
if (MFI.isDeadObjectIndex(I))
continue;
@@ -383,11 +383,13 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &YMF,
YMF.FixedStackObjects.push_back(YamlObject);
StackObjectOperandMapping.insert(
std::make_pair(I, FrameIndexOperand::createFixed(ID)));
+ ++ID;
+ assert(YMF.FixedStackObjects.size() == ID);
}
// Process ordinary stack objects.
ID = 0;
- for (int I = 0, E = MFI.getObjectIndexEnd(); I < E; ++I, ++ID) {
+ for (int I = 0, E = MFI.getObjectIndexEnd(); I < E; ++I) {
if (MFI.isDeadObjectIndex(I))
continue;
@@ -409,6 +411,8 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &YMF,
YMF.StackObjects.push_back(YamlObject);
StackObjectOperandMapping.insert(std::make_pair(
I, FrameIndexOperand::create(YamlObject.Name.Value, ID)));
+ ++ID;
+ assert(YMF.StackObjects.size() == ID);
}
for (const auto &CSInfo : MFI.getCalleeSavedInfo()) {
More information about the llvm-commits
mailing list