From c0923623007b796fe5c1ce76b264fe07df505700 Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Fri, 9 Apr 2010 15:18:34 +0000 Subject: [PATCH] performance: cache result of looking up user git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100862 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/AddrModeMatcher.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Transforms/Utils/AddrModeMatcher.cpp b/lib/Transforms/Utils/AddrModeMatcher.cpp index c70bab5492e..ea9d1c1b146 100644 --- a/lib/Transforms/Utils/AddrModeMatcher.cpp +++ b/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(*UI)) { + User *U = *UI; + + if (LoadInst *LI = dyn_cast(U)) { MemoryUses.push_back(std::make_pair(LI, UI.getOperandNo())); continue; } - if (StoreInst *SI = dyn_cast(*UI)) { + if (StoreInst *SI = dyn_cast(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(*UI)) { + if (CallInst *CI = dyn_cast(U)) { InlineAsm *IA = dyn_cast(CI->getCalledValue()); if (IA == 0) return true; @@ -456,7 +458,7 @@ static bool FindAllMemoryUses(Instruction *I, continue; } - if (FindAllMemoryUses(cast(*UI), MemoryUses, ConsideredInsts, + if (FindAllMemoryUses(cast(U), MemoryUses, ConsideredInsts, TLI)) return true; } -- 2.11.0