diff options
author | Gabor Greif <ggreif@gmail.com> | 2010-07-09 14:18:23 +0000 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2010-07-09 14:18:23 +0000 |
commit | a02f232c1b1180043af679c128ed584b09d53df1 (patch) | |
tree | d988549be903b26a4a45d79edb0d9c403402e961 /llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp | |
parent | f0821f39ee3a2ad46e07c6fa81426478cc22cf39 (diff) | |
download | bcm5719-llvm-a02f232c1b1180043af679c128ed584b09d53df1.tar.gz bcm5719-llvm-a02f232c1b1180043af679c128ed584b09d53df1.zip |
cache result of operator*
llvm-svn: 107966
Diffstat (limited to 'llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index fc4cecea9b9..c0de1938b2d 100644 --- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -69,11 +69,12 @@ bool llvm::isAllocaPromotable(const AllocaInst *AI) { // 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 @@ bool llvm::isAllocaPromotable(const AllocaInst *AI) { } else { return false; } + } return true; } |