cache result of operator*
authorGabor Greif <ggreif@gmail.com>
Mon, 12 Jul 2010 15:48:26 +0000 (15:48 +0000)
committerGabor Greif <ggreif@gmail.com>
Mon, 12 Jul 2010 15:48:26 +0000 (15:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108150 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp

index 946c3ee0c7829277de4be16895ad9fd7470a0aaa..8933a0b137ab4bbd9fa25857ba482347767d8aaa 100644 (file)
@@ -525,17 +525,20 @@ bool InstCombiner::SimplifyStoreAtEndOfBlock(StoreInst &SI) {
   // Determine whether Dest has exactly two predecessors and, if so, compute
   // the other predecessor.
   pred_iterator PI = pred_begin(DestBB);
+  BasicBlock *P = *PI;
   BasicBlock *OtherBB = 0;
-  if (*PI != StoreBB)
-    OtherBB = *PI;
-  ++PI;
-  if (PI == pred_end(DestBB))
+
+  if (P != StoreBB)
+    OtherBB = P;
+
+  if (++PI == pred_end(DestBB))
     return false;
   
-  if (*PI != StoreBB) {
+  P = *PI;
+  if (P != StoreBB) {
     if (OtherBB)
       return false;
-    OtherBB = *PI;
+    OtherBB = P;
   }
   if (++PI != pred_end(DestBB))
     return false;