Neaten up this method. Check that if there is only one
predecessor then it's Src.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149843 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index f6d6b90..6541253 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -1999,10 +1999,10 @@
// only reachable from Src, in practice it is pointless since at the time
// GVN runs all such loops have preheaders, which means that Dst will have
// been changed to have only one predecessor, namely Src.
- pred_iterator PI = pred_begin(Dst), PE = pred_end(Dst);
- assert(PI != PE && "No edge between these basic blocks!");
+ BasicBlock *Pred = Dst->getSinglePredecessor();
+ assert((!Pred || Pred == Src) && "No edge between these basic blocks!");
(void)Src;
- return PE == ++PI;
+ return Pred != 0;
}
/// processInstruction - When calculating availability, handle an instruction