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

lib/Transforms/InstCombine/InstCombinePHI.cpp

index 65f0393687046aac87c510df9207564181fae16d..f7fc62f9dc4fca89ae64d22ee1921edfce16988a 100644 (file)
@@ -230,8 +230,9 @@ static bool isSafeAndProfitableToSinkLoad(LoadInst *L) {
     bool isAddressTaken = false;
     for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end();
          UI != E; ++UI) {
-      if (isa<LoadInst>(UI)) continue;
-      if (StoreInst *SI = dyn_cast<StoreInst>(*UI)) {
+      User *U = *UI;
+      if (isa<LoadInst>(U)) continue;
+      if (StoreInst *SI = dyn_cast<StoreInst>(U)) {
         // If storing TO the alloca, then the address isn't taken.
         if (SI->getOperand(1) == AI) continue;
       }