recommit r108131 (hich has been backed out in r108135) with a fix
authorGabor Greif <ggreif@gmail.com>
Mon, 12 Jul 2010 12:02:10 +0000 (12:02 +0000)
committerGabor Greif <ggreif@gmail.com>
Mon, 12 Jul 2010 12:02:10 +0000 (12:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108137 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/TailDuplication.cpp

index 2306a77670fe4464b4b9f8c9f528b6e956849d81..9208238f4ba5e102190917471801a3109bfdf842 100644 (file)
@@ -206,12 +206,13 @@ static BasicBlock *FindObviousSharedDomOf(BasicBlock *SrcBlock,
   // there is only one other pred, get it, otherwise we can't handle it.
   PI = pred_begin(DstBlock); PE = pred_end(DstBlock);
   BasicBlock *DstOtherPred = 0;
-  if (*PI == SrcBlock) {
+  BasicBlock *P = *PI;
+  if (P == SrcBlock) {
     if (++PI == PE) return 0;
     DstOtherPred = *PI;
     if (++PI != PE) return 0;
   } else {
-    DstOtherPred = *PI;
+    DstOtherPred = P;
     if (++PI == PE || *PI != SrcBlock || ++PI != PE) return 0;
   }