<div class="gmail_extra"><div class="gmail_quote">On Mon, Sep 10, 2012 at 1:44 AM, Nadav Rotem <span dir="ltr"><<a href="mailto:nrotem@apple.com" target="_blank" class="cremed">nrotem@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: nadav<br>
Date: Mon Sep 10 03:44:15 2012<br>
New Revision: 163495<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=163495&view=rev" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project?rev=163495&view=rev</a><br>
Log:<br>
Add an assertion that the frame index is indeed inside the declared lifetime region.<br>
<br>
Modified:<br>
    llvm/trunk/lib/CodeGen/StackColoring.cpp<br>
<br>
Modified: llvm/trunk/lib/CodeGen/StackColoring.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackColoring.cpp?rev=163495&r1=163494&r2=163495&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackColoring.cpp?rev=163495&r1=163494&r2=163495&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/CodeGen/StackColoring.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/StackColoring.cpp Mon Sep 10 03:44:15 2012<br>
@@ -454,6 +454,11 @@<br>
   for (BB = MF->begin(), BBE = MF->end(); BB != BBE; ++BB)<br>
     for (I = BB->begin(), IE = BB->end(); I != IE; ++I) {<br>
<br>
+      // Skip lifetime markers. We'll remove them soon.<br>
+      if (I->getOpcode() == TargetOpcode::LIFETIME_START ||<br>
+          I->getOpcode() == TargetOpcode::LIFETIME_END)<br>
+        continue;<br>
+<br>
       // Update the MachineMemOperand to use the new alloca.<br>
       for (MachineInstr::mmo_iterator MM = I->memoperands_begin(),<br>
            E = I->memoperands_end(); MM != E; ++MM) {<br>
@@ -491,6 +496,17 @@<br>
         if (!SlotRemap.count(FromSlot))<br>
           continue;<br>
<br>
+        // In a debug build, check that the instruction that we are check is<br>
+        // inside its expected live range.</blockquote><div><br></div><div>This sentence doesn't parse for me... too many 'check's?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 If the instruction is not inside<br>
+        // the calculated range then it means that the alloca usage moved<br>
+        // outside of the lifetime markers.<br>
+#ifndef NDEBUG<br>
+        SlotIndex Index = Indexes->getInstructionIndex(I);<br>
+        LiveInterval* Interval = Intervals[FromSlot];<br>
+        assert(Interval->find(Index) != Interval->end() &&<br>
+               "Found instruction usage outside of live range.");<br>
+#endif<br>
+<br>
         // Fix the machine instructions.<br>
         int ToSlot = SlotRemap[FromSlot];<br>
         MO.setIndex(ToSlot);<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" class="cremed">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" class="cremed">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>