aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SlotIndexes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/SlotIndexes.cpp')
-rw-r--r--lib/CodeGen/SlotIndexes.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/CodeGen/SlotIndexes.cpp b/lib/CodeGen/SlotIndexes.cpp
index f85384bc5c77..782af124a664 100644
--- a/lib/CodeGen/SlotIndexes.cpp
+++ b/lib/CodeGen/SlotIndexes.cpp
@@ -92,13 +92,14 @@ bool SlotIndexes::runOnMachineFunction(MachineFunction &fn) {
functionSize = 0;
unsigned index = 0;
+ push_back(createEntry(0, index));
+
// Iterate over the the function.
for (MachineFunction::iterator mbbItr = mf->begin(), mbbEnd = mf->end();
mbbItr != mbbEnd; ++mbbItr) {
MachineBasicBlock *mbb = &*mbbItr;
// Insert an index for the MBB start.
- push_back(createEntry(0, index));
SlotIndex blockStartIndex(back(), SlotIndex::LOAD);
index += SlotIndex::NUM;
@@ -137,16 +138,16 @@ bool SlotIndexes::runOnMachineFunction(MachineFunction &fn) {
index += SlotIndex::NUM;
}
- SlotIndex blockEndIndex(back(), SlotIndex::STORE);
+ // One blank instruction at the end.
+ push_back(createEntry(0, index));
+
+ SlotIndex blockEndIndex(back(), SlotIndex::LOAD);
mbb2IdxMap.insert(
std::make_pair(mbb, std::make_pair(blockStartIndex, blockEndIndex)));
idx2MBBMap.push_back(IdxMBBPair(blockStartIndex, mbb));
}
- // One blank instruction at the end.
- push_back(createEntry(0, index));
-
// Sort the Idx2MBBMap
std::sort(idx2MBBMap.begin(), idx2MBBMap.end(), Idx2MBBCompare());