summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-03-18 22:32:43 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-03-18 22:32:43 +0000
commitcb1c81afa0f319de56afddd1b13f6b1ce3cdec1a (patch)
treed64bb90425ac4cb60f6b4b363f1255cef37efc9a /llvm/lib/Transforms
parent2f6bec6ee9f289b2c042d32f781130e053d2f116 (diff)
downloadbcm5719-llvm-cb1c81afa0f319de56afddd1b13f6b1ce3cdec1a.tar.gz
bcm5719-llvm-cb1c81afa0f319de56afddd1b13f6b1ce3cdec1a.zip
Fix use_iterator crash in ObjCArc from r203364
The use_iterator redesign in r203364 introduced an increment past the end of a range in -objc-arc-contract. Added an explicit check for the end of the range. <rdar://problem/16333235> llvm-svn: 204195
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
index 1412181766c..3da5a0e6d24 100644
--- a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
+++ b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
@@ -475,8 +475,9 @@ bool ObjCARCContract::runOnFunction(Function &F) {
for (unsigned i = 0, e = PHI->getNumIncomingValues(); i != e; ++i)
if (PHI->getIncomingBlock(i) == BB) {
// Keep the UI iterator valid.
- if (&PHI->getOperandUse(
- PHINode::getOperandNumForIncomingValue(i)) == &U)
+ if (UI != UE &&
+ &PHI->getOperandUse(
+ PHINode::getOperandNumForIncomingValue(i)) == &*UI)
++UI;
PHI->setIncomingValue(i, Replacement);
}
OpenPOWER on IntegriCloud