mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-08 13:00:50 +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;
|
||||
|
||||
for (; SI != SE; ++SI) {
|
||||
PtrState &SuccS = BBStates[*SI].getPtrBottomUpState(Arg);
|
||||
switch (SuccS.GetSeq()) {
|
||||
Sequence SuccSSeq = S_None;
|
||||
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_CanRelease: {
|
||||
if (!S.RRI.KnownSafe && !SuccS.RRI.KnownSafe)
|
||||
if (!S.RRI.KnownSafe && !SuccSRRIKnownSafe) {
|
||||
S.ClearSequenceProgress();
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case S_Use:
|
||||
@ -2435,7 +2445,7 @@ ObjCARCOpt::CheckForCFGHazards(const BasicBlock *BB,
|
||||
case S_Stop:
|
||||
case S_Release:
|
||||
case S_MovableRelease:
|
||||
if (!S.RRI.KnownSafe && !SuccS.RRI.KnownSafe)
|
||||
if (!S.RRI.KnownSafe && !SuccSRRIKnownSafe)
|
||||
AllSuccsHaveSame = false;
|
||||
break;
|
||||
case S_Retain:
|
||||
@ -2464,11 +2474,21 @@ ObjCARCOpt::CheckForCFGHazards(const BasicBlock *BB,
|
||||
--SE;
|
||||
|
||||
for (; SI != SE; ++SI) {
|
||||
PtrState &SuccS = BBStates[*SI].getPtrBottomUpState(Arg);
|
||||
switch (SuccS.GetSeq()) {
|
||||
Sequence SuccSSeq = S_None;
|
||||
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: {
|
||||
if (!S.RRI.KnownSafe && !SuccS.RRI.KnownSafe)
|
||||
if (!S.RRI.KnownSafe && !SuccSRRIKnownSafe) {
|
||||
S.ClearSequenceProgress();
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case S_CanRelease:
|
||||
@ -2478,7 +2498,7 @@ ObjCARCOpt::CheckForCFGHazards(const BasicBlock *BB,
|
||||
case S_Release:
|
||||
case S_MovableRelease:
|
||||
case S_Use:
|
||||
if (!S.RRI.KnownSafe && !SuccS.RRI.KnownSafe)
|
||||
if (!S.RRI.KnownSafe && !SuccSRRIKnownSafe)
|
||||
AllSuccsHaveSame = false;
|
||||
break;
|
||||
case S_Retain:
|
||||
|
Loading…
Reference in New Issue
Block a user