<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:gberry@codeaurora.org" title="Geoff Berry <gberry@codeaurora.org>"> <span class="fn">Geoff Berry</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Assertion in VirtRegRewriter: `toIndex_(n) < storage_.size() && "index out of bounds!"'"
   href="https://bugs.llvm.org/show_bug.cgi?id=34828">bug 34828</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>FIXED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Assertion in VirtRegRewriter: `toIndex_(n) < storage_.size() && "index out of bounds!"'"
   href="https://bugs.llvm.org/show_bug.cgi?id=34828#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Assertion in VirtRegRewriter: `toIndex_(n) < storage_.size() && "index out of bounds!"'"
   href="https://bugs.llvm.org/show_bug.cgi?id=34828">bug 34828</a>
              from <span class="vcard"><a class="email" href="mailto:gberry@codeaurora.org" title="Geoff Berry <gberry@codeaurora.org>"> <span class="fn">Geoff Berry</span></a>
</span></b>
        <pre>This bug should be fixed by the change below, which will be present when this
change is re-enabled:

--- a/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/lib/CodeGen/MachineCopyPropagation.cpp
@@ -102,7 +102,7 @@ using Reg2MIMap = DenseMap<unsigned, MachineInstr *>;
     MachineFunction *MF;
     SlotIndexes *Indexes;
     LiveIntervals *LIS;
-    const VirtRegMap *VRM;
+    VirtRegMap *VRM;
     // True if this pass being run before virtual registers are remapped to
     // physical ones.
     bool PreRegRewrite;
@@ -173,6 +173,7 @@ using Reg2MIMap = DenseMap<unsigned, MachineInstr *>;
                                          unsigned NewUseSubReg);
     /// LiveRangeEdit callback for eliminateDeadDefs().
     void LRE_WillEraseInstruction(MachineInstr *MI) override;
+    void LRE_DidCloneVirtReg(unsigned NewReg, unsigned OrigReg) override;

     /// Candidates for deletion.
     SmallSetVector<MachineInstr*, 8> MaybeDeadCopies;
@@ -603,6 +604,20 @@ void
MachineCopyPropagation::LRE_WillEraseInstruction(MachineInstr *MI) {
   Changed = true;
 }

+/// Update VRM when new registers are added by
LiveRangeEdit::eliminateDeadDefs.
+void MachineCopyPropagation::LRE_DidCloneVirtReg(unsigned NewReg,
+                                                 unsigned OrigReg) {
+
+  DEBUG(dbgs() << "MCP: Assigning split reg " << PrintReg(NewReg, TRI) << "\n"
+        << "    based on original reg " << PrintReg(OrigReg, TRI) << "\n");
+
+  VRM->grow();
+  VRM->assignVirt2Phys(NewReg, VRM->getPhys(OrigReg));
+
+  DEBUG(dbgs() << "    to phys reg " << PrintReg(VRM->getPhys(NewReg), TRI)
+               << "\n");
+}
+
 /// Look for available copies whose destination register is used by \p MI and
 /// replace the use in \p MI with the copy's source register.
 void MachineCopyPropagation::forwardUses(MachineInstr &MI) {</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>