[llvm-commits] [llvm] r101250 - /llvm/trunk/lib/Transforms/Scalar/LICM.cpp
Gabor Greif
ggreif at gmail.com
Wed Apr 14 09:13:56 PDT 2010
Author: ggreif
Date: Wed Apr 14 11:13:56 2010
New Revision: 101250
URL: http://llvm.org/viewvc/llvm-project?rev=101250&view=rev
Log:
performance: cache the dereferenced use_iterator
Modified:
llvm/trunk/lib/Transforms/Scalar/LICM.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=101250&r1=101249&r2=101250&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Wed Apr 14 11:13:56 2010
@@ -683,16 +683,18 @@
// 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.
}
More information about the llvm-commits
mailing list