diff options
| author | Gabor Greif <ggreif@gmail.com> | 2010-04-14 16:13:56 +0000 |
|---|---|---|
| committer | Gabor Greif <ggreif@gmail.com> | 2010-04-14 16:13:56 +0000 |
| commit | a49686fa3e7d96af921bb50421a3114b5e63a07e (patch) | |
| tree | 99f0bb62462468d7b12e884c6c51821fa21a8b24 /llvm | |
| parent | 2bf2d3d0165f721a789109f06cd2c012a141a7a8 (diff) | |
| download | bcm5719-llvm-a49686fa3e7d96af921bb50421a3114b5e63a07e.tar.gz bcm5719-llvm-a49686fa3e7d96af921bb50421a3114b5e63a07e.zip | |
performance: cache the dereferenced use_iterator
llvm-svn: 101250
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LICM.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index d7ace342fcb..73473952912 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -683,16 +683,18 @@ void LICM::PromoteValuesInLoop() { // to LI as we are loading or storing. Since we know that the value is // stored in this loop, this will always succeed. for (Value::use_iterator UI = Ptr->use_begin(), E = Ptr->use_end(); - UI != E; ++UI) - if (LoadInst *LI = dyn_cast<LoadInst>(*UI)) { + UI != E; ++UI) { + User *U = *UI; + if (LoadInst *LI = dyn_cast<LoadInst>(U)) { LoadValue = LI; break; - } else if (StoreInst *SI = dyn_cast<StoreInst>(*UI)) { + } else if (StoreInst *SI = dyn_cast<StoreInst>(U)) { if (SI->getOperand(1) == Ptr) { LoadValue = SI->getOperand(0); break; } } + } assert(LoadValue && "No store through the pointer found!"); PointerValueNumbers.push_back(LoadValue); // Remember this for later. } |

