[llvm-bugs] [Bug 34828] Assertion in VirtRegRewriter: `toIndex_(n) < storage_.size() && "index out of bounds!"'
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Oct 4 13:51:22 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34828
Geoff Berry <gberry at codeaurora.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Geoff Berry <gberry at codeaurora.org> ---
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) {
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171004/8be03ca3/attachment.html>
More information about the llvm-bugs
mailing list