Workaround for PR2207, in which pred_iterator assert gets triggered due to a
[oota-llvm.git] / include / llvm / Support / CFG.h
index 937472d5816fd56fecf249765e180aecda7be853..f8cbeb0a50f053553e320912a54cfd8df51ddce1 100644 (file)
@@ -36,8 +36,11 @@ public:
 
   inline void advancePastNonPreds() {
     // Loop to ignore non predecessor uses (for example PHI nodes)...
-    while (!It.atEnd() && !isa<TerminatorInst>(*It) && !isa<BasicBlock>(*It))
+    while (!It.atEnd()) {
+      if (isa<TerminatorInst>(*It) || isa<BasicBlock>(*It))
+       break;
       ++It;
+    }
   }
 
   inline PredIterator(_Ptr *bb) : It(bb->use_begin()) {