IndVarSimplify: Don't let LFTR compare against a poison value
[oota-llvm.git] / lib / Transforms / ObjCARC / ProvenanceAnalysis.cpp
index ff38c9df8020ef4153df0421b47d3211d4a4d87b..22be6fdf45f9fbe8dc423bf4ae764aef20d0827a 100644 (file)
@@ -72,18 +72,17 @@ bool ProvenanceAnalysis::relatedPHI(const PHINode *A,
 
 /// Test if the value of P, or any value covered by its provenance, is ever
 /// stored within the function (not counting callees).
-static bool isStoredObjCPointer(const Value *P) {
+static bool IsStoredObjCPointer(const Value *P) {
   SmallPtrSet<const Value *, 8> Visited;
   SmallVector<const Value *, 8> Worklist;
   Worklist.push_back(P);
   Visited.insert(P);
   do {
     P = Worklist.pop_back_val();
-    for (Value::const_use_iterator UI = P->use_begin(), UE = P->use_end();
-         UI != UE; ++UI) {
-      const User *Ur = *UI;
+    for (const Use &U : P->uses()) {
+      const User *Ur = U.getUser();
       if (isa<StoreInst>(Ur)) {
-        if (UI.getOperandNo() == 0)
+        if (U.getOperandNo() == 0)
           // The pointer is stored.
           return true;
         // The pointed is stored through.
@@ -132,18 +131,18 @@ bool ProvenanceAnalysis::relatedCheck(const Value *A,
   if (AIsIdentified) {
     // Check for an obvious escape.
     if (isa<LoadInst>(B))
-      return isStoredObjCPointer(A);
+      return IsStoredObjCPointer(A);
     if (BIsIdentified) {
       // Check for an obvious escape.
       if (isa<LoadInst>(A))
-        return isStoredObjCPointer(B);
+        return IsStoredObjCPointer(B);
       // Both pointers are identified and escapes aren't an evident problem.
       return false;
     }
   } else if (BIsIdentified) {
     // Check for an obvious escape.
     if (isa<LoadInst>(A))
-      return isStoredObjCPointer(B);
+      return IsStoredObjCPointer(B);
   }
 
    // Special handling for PHI and Select.