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

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 8 00:53:16 PDT 2018


HsiangKai updated this revision to Diff 168617.

Repository:
  rL LLVM

https://reviews.llvm.org/D52927

Files:
  include/llvm/CodeGen/SlotIndexes.h


Index: include/llvm/CodeGen/SlotIndexes.h
===================================================================
--- include/llvm/CodeGen/SlotIndexes.h
+++ 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.168617.patch
Type: text/x-patch
Size: 1252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181008/33555c38/attachment.bin>


More information about the llvm-commits mailing list