diff options
| author | Gabor Greif <ggreif@gmail.com> | 2010-04-09 15:18:34 +0000 |
|---|---|---|
| committer | Gabor Greif <ggreif@gmail.com> | 2010-04-09 15:18:34 +0000 |
| commit | ef60190a00b631436781308a7c9ac4c783ee10e7 (patch) | |
| tree | a5f95237c0c3100fea64e84d5682c6833ac5c665 | |
| parent | d23fa7d90d53aaa482f9310994908c78bcceb61c (diff) | |
| download | bcm5719-llvm-ef60190a00b631436781308a7c9ac4c783ee10e7.tar.gz bcm5719-llvm-ef60190a00b631436781308a7c9ac4c783ee10e7.zip | |
performance: cache result of looking up user
llvm-svn: 100862
| -rw-r--r-- | llvm/lib/Transforms/Utils/AddrModeMatcher.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/AddrModeMatcher.cpp b/llvm/lib/Transforms/Utils/AddrModeMatcher.cpp index c70bab5492e..ea9d1c1b146 100644 --- a/llvm/lib/Transforms/Utils/AddrModeMatcher.cpp +++ b/llvm/lib/Transforms/Utils/AddrModeMatcher.cpp @@ -434,19 +434,21 @@ static bool FindAllMemoryUses(Instruction *I, // Loop over all the uses, recursively processing them. for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E; ++UI) { - if (LoadInst *LI = dyn_cast<LoadInst>(*UI)) { + User *U = *UI; + + if (LoadInst *LI = dyn_cast<LoadInst>(U)) { MemoryUses.push_back(std::make_pair(LI, UI.getOperandNo())); continue; } - if (StoreInst *SI = dyn_cast<StoreInst>(*UI)) { + if (StoreInst *SI = dyn_cast<StoreInst>(U)) { unsigned opNo = UI.getOperandNo(); if (opNo == 0) return true; // Storing addr, not into addr. MemoryUses.push_back(std::make_pair(SI, opNo)); continue; } - if (CallInst *CI = dyn_cast<CallInst>(*UI)) { + if (CallInst *CI = dyn_cast<CallInst>(U)) { InlineAsm *IA = dyn_cast<InlineAsm>(CI->getCalledValue()); if (IA == 0) return true; @@ -456,7 +458,7 @@ static bool FindAllMemoryUses(Instruction *I, continue; } - if (FindAllMemoryUses(cast<Instruction>(*UI), MemoryUses, ConsideredInsts, + if (FindAllMemoryUses(cast<Instruction>(U), MemoryUses, ConsideredInsts, TLI)) return true; } |

