[PATCH] D52927: [CodeGen] Fix for PR39094.

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 18 18:54:51 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL344770: [CodeGen] Fix for PR39094. (authored by HsiangKai, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D52927?vs=168619&id=170142#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52927

Files:
  llvm/trunk/include/llvm/CodeGen/SlotIndexes.h


Index: llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
===================================================================
--- llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
+++ llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
@@ -413,10 +413,14 @@
     /// Returns the base index for the given instruction.
     SlotIndex getInstructionIndex(const MachineInstr &MI) const {
       // Instructions inside a bundle have the same number as the bundle itself.
-      const MachineInstr &BundleStart = *getBundleStart(MI.getIterator());
-      assert(!BundleStart.isDebugInstr() &&
+      auto BundleStart = getBundleStart(MI.getIterator());
+      auto BundleEnd = getBundleEnd(MI.getIterator());
+      // Use the first non-debug instruction in the bundle to get SlotIndex.
+      const MachineInstr &BundleNonDebug =
+          *skipDebugInstructionsForward(BundleStart, BundleEnd);
+      assert(!BundleNonDebug.isDebugInstr() &&
              "Could not use a debug instruction to query mi2iMap.");
-      Mi2IndexMap::const_iterator itr = mi2iMap.find(&BundleStart);
+      Mi2IndexMap::const_iterator itr = mi2iMap.find(&BundleNonDebug);
       assert(itr != mi2iMap.end() && "Instruction not found in maps.");
       return itr->second;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52927.170142.patch
Type: text/x-patch
Size: 1242 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181019/f193caf0/attachment.bin>


More information about the llvm-commits mailing list