mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-24 03:25:00 +00:00
Fix an iterator invalidation problem. operator[] on a DenseMap
can insert a new element, invalidating iterators. Use find instead, and handle the case where the key is not found explicitly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151871 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
22cc4ccc9e
commit
70e2968866
@ -2421,12 +2421,22 @@ ObjCARCOpt::CheckForCFGHazards(const BasicBlock *BB,
|
|||||||
--SE;
|
--SE;
|
||||||
|
|
||||||
for (; SI != SE; ++SI) {
|
for (; SI != SE; ++SI) {
|
||||||
PtrState &SuccS = BBStates[*SI].getPtrBottomUpState(Arg);
|
Sequence SuccSSeq = S_None;
|
||||||
switch (SuccS.GetSeq()) {
|
bool SuccSRRIKnownSafe = false;
|
||||||
|
// If VisitBottomUp has visited this successor, take what we know about it.
|
||||||
|
DenseMap<const BasicBlock *, BBState>::iterator BBI = BBStates.find(*SI);
|
||||||
|
if (BBI != BBStates.end()) {
|
||||||
|
const PtrState &SuccS = BBI->second.getPtrBottomUpState(Arg);
|
||||||
|
SuccSSeq = SuccS.GetSeq();
|
||||||
|
SuccSRRIKnownSafe = SuccS.RRI.KnownSafe;
|
||||||
|
}
|
||||||
|
switch (SuccSSeq) {
|
||||||
case S_None:
|
case S_None:
|
||||||
case S_CanRelease: {
|
case S_CanRelease: {
|
||||||
if (!S.RRI.KnownSafe && !SuccS.RRI.KnownSafe)
|
if (!S.RRI.KnownSafe && !SuccSRRIKnownSafe) {
|
||||||
S.ClearSequenceProgress();
|
S.ClearSequenceProgress();
|
||||||
|
break;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case S_Use:
|
case S_Use:
|
||||||
@ -2435,7 +2445,7 @@ ObjCARCOpt::CheckForCFGHazards(const BasicBlock *BB,
|
|||||||
case S_Stop:
|
case S_Stop:
|
||||||
case S_Release:
|
case S_Release:
|
||||||
case S_MovableRelease:
|
case S_MovableRelease:
|
||||||
if (!S.RRI.KnownSafe && !SuccS.RRI.KnownSafe)
|
if (!S.RRI.KnownSafe && !SuccSRRIKnownSafe)
|
||||||
AllSuccsHaveSame = false;
|
AllSuccsHaveSame = false;
|
||||||
break;
|
break;
|
||||||
case S_Retain:
|
case S_Retain:
|
||||||
@ -2464,11 +2474,21 @@ ObjCARCOpt::CheckForCFGHazards(const BasicBlock *BB,
|
|||||||
--SE;
|
--SE;
|
||||||
|
|
||||||
for (; SI != SE; ++SI) {
|
for (; SI != SE; ++SI) {
|
||||||
PtrState &SuccS = BBStates[*SI].getPtrBottomUpState(Arg);
|
Sequence SuccSSeq = S_None;
|
||||||
switch (SuccS.GetSeq()) {
|
bool SuccSRRIKnownSafe = false;
|
||||||
|
// If VisitBottomUp has visited this successor, take what we know about it.
|
||||||
|
DenseMap<const BasicBlock *, BBState>::iterator BBI = BBStates.find(*SI);
|
||||||
|
if (BBI != BBStates.end()) {
|
||||||
|
const PtrState &SuccS = BBI->second.getPtrBottomUpState(Arg);
|
||||||
|
SuccSSeq = SuccS.GetSeq();
|
||||||
|
SuccSRRIKnownSafe = SuccS.RRI.KnownSafe;
|
||||||
|
}
|
||||||
|
switch (SuccSSeq) {
|
||||||
case S_None: {
|
case S_None: {
|
||||||
if (!S.RRI.KnownSafe && !SuccS.RRI.KnownSafe)
|
if (!S.RRI.KnownSafe && !SuccSRRIKnownSafe) {
|
||||||
S.ClearSequenceProgress();
|
S.ClearSequenceProgress();
|
||||||
|
break;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case S_CanRelease:
|
case S_CanRelease:
|
||||||
@ -2478,7 +2498,7 @@ ObjCARCOpt::CheckForCFGHazards(const BasicBlock *BB,
|
|||||||
case S_Release:
|
case S_Release:
|
||||||
case S_MovableRelease:
|
case S_MovableRelease:
|
||||||
case S_Use:
|
case S_Use:
|
||||||
if (!S.RRI.KnownSafe && !SuccS.RRI.KnownSafe)
|
if (!S.RRI.KnownSafe && !SuccSRRIKnownSafe)
|
||||||
AllSuccsHaveSame = false;
|
AllSuccsHaveSame = false;
|
||||||
break;
|
break;
|
||||||
case S_Retain:
|
case S_Retain:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user