Skip to content

Commit

Permalink
ScheduleDAGInstrs: Fix memory corruption
Browse files Browse the repository at this point in the history
We have to modify V2SU before inserting new elements into the
CurrentVRegDefs set because that may move V2SU in memory invalidating
the reference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270644 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
MatzeB committed May 25, 2016
1 parent b4811e7 commit 20c7e33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/CodeGen/ScheduleDAGInstrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,10 @@ void ScheduleDAGInstrs::addVRegDefDeps(SUnit *SU, unsigned OperIdx) {
// VReg2SUnit for the non-overlapping part.
LaneBitmask OverlapMask = V2SU.LaneMask & LaneMask;
LaneBitmask NonOverlapMask = V2SU.LaneMask & ~LaneMask;
if (NonOverlapMask != 0)
CurrentVRegDefs.insert(VReg2SUnit(Reg, NonOverlapMask, V2SU.SU));
V2SU.SU = SU;
V2SU.LaneMask = OverlapMask;
if (NonOverlapMask != 0)
CurrentVRegDefs.insert(VReg2SUnit(Reg, NonOverlapMask, DefSU));
}
// If there was no CurrentVRegDefs entry for some lanes yet, create one.
if (LaneMask != 0)
Expand Down

0 comments on commit 20c7e33

Please sign in to comment.