[llvm-commits] [llvm] r107966 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
Gabor Greif
ggreif at gmail.com
Fri Jul 9 07:18:24 PDT 2010
Author: ggreif
Date: Fri Jul 9 09:18:23 2010
New Revision: 107966
URL: http://llvm.org/viewvc/llvm-project?rev=107966&view=rev
Log:
cache result of operator*
Modified:
llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=107966&r1=107965&r2=107966&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Fri Jul 9 09:18:23 2010
@@ -69,11 +69,12 @@
// Only allow direct and non-volatile loads and stores...
for (Value::const_use_iterator UI = AI->use_begin(), UE = AI->use_end();
- UI != UE; ++UI) // Loop over all of the uses of the alloca
- if (const LoadInst *LI = dyn_cast<LoadInst>(*UI)) {
+ UI != UE; ++UI) { // Loop over all of the uses of the alloca
+ const User *U = *UI;
+ if (const LoadInst *LI = dyn_cast<LoadInst>(U)) {
if (LI->isVolatile())
return false;
- } else if (const StoreInst *SI = dyn_cast<StoreInst>(*UI)) {
+ } else if (const StoreInst *SI = dyn_cast<StoreInst>(U)) {
if (SI->getOperand(0) == AI)
return false; // Don't allow a store OF the AI, only INTO the AI.
if (SI->isVolatile())
@@ -81,6 +82,7 @@
} else {
return false;
}
+ }
return true;
}
More information about the llvm-commits
mailing list