[llvm-commits] [llvm] r149843 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp
Duncan Sands
baldrick at free.fr
Sun Feb 5 11:43:37 PST 2012
Author: baldrick
Date: Sun Feb 5 13:43:37 2012
New Revision: 149843
URL: http://llvm.org/viewvc/llvm-project?rev=149843&view=rev
Log:
Neaten up this method. Check that if there is only one
predecessor then it's Src.
Modified:
llvm/trunk/lib/Transforms/Scalar/GVN.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=149843&r1=149842&r2=149843&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Sun Feb 5 13:43:37 2012
@@ -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
More information about the llvm-commits
mailing list