[PATCH] D91066: [SlotIndexes] Consider existing index range in insertMBBIntoMaps
Carl Ritson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 9 03:33:01 PST 2020
critson created this revision.
critson added reviewers: qcolombet, kariddi, arsen, MaskRay.
Herald added subscribers: llvm-commits, arphaman.
Herald added a project: LLVM.
critson requested review of this revision.
When an insertion point is specified in insertMBBIntoMaps the
index range of existing instructions in the block needs to be
considered.
Repository:
rG LLVM Github Monorepo
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.303811.patch
Type: text/x-patch
Size: 1308 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201109/2a522407/attachment.bin>
More information about the llvm-commits
mailing list