[PATCH] D91066: [SlotIndexes] Consider existing index range in insertMBBIntoMaps
Carl Ritson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 22 16:55:18 PST 2020
critson updated this revision to Diff 306949.
critson added a comment.
Ping
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91066/new/
https://reviews.llvm.org/D91066
Files:
llvm/include/llvm/CodeGen/SlotIndexes.h
Index: llvm/include/llvm/CodeGen/SlotIndexes.h
===================================================================
--- llvm/include/llvm/CodeGen/SlotIndexes.h
+++ llvm/include/llvm/CodeGen/SlotIndexes.h
@@ -611,15 +611,18 @@
MachineInstr *InsertionPoint = nullptr) {
MachineFunction::iterator nextMBB =
std::next(MachineFunction::iterator(mbb));
+ bool IsLastMBB = nextMBB == mbb->getParent()->end();
IndexListEntry *startEntry = nullptr;
IndexListEntry *endEntry = nullptr;
IndexList::iterator newItr;
if (InsertionPoint) {
startEntry = createEntry(nullptr, 0);
- endEntry = getInstructionIndex(*InsertionPoint).listEntry();
- newItr = indexList.insert(endEntry->getIterator(), startEntry);
- } else if (nextMBB == mbb->getParent()->end()) {
+ endEntry = IsLastMBB ? &indexList.back()
+ : getMBBStartIdx(&*nextMBB).listEntry();
+ auto *InsIdx = getInstructionIndex(*InsertionPoint).listEntry();
+ newItr = indexList.insert(InsIdx->getIterator(), startEntry);
+ } else if (IsLastMBB) {
startEntry = &indexList.back();
endEntry = createEntry(nullptr, 0);
newItr = indexList.insertAfter(startEntry->getIterator(), endEntry);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91066.306949.patch
Type: text/x-patch
Size: 1309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201123/8c7ba960/attachment.bin>
More information about the llvm-commits
mailing list