From: Gabor Greif Date: Wed, 24 Mar 2010 10:29:52 +0000 (+0000) Subject: increase const goodness and remove pointless getUser() calls X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bd1f99341eb1b0afd7e42d2741eb97c7ae0d86a3;p=oota-llvm.git increase const goodness and remove pointless getUser() calls git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99395 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 7e37938868d..e28478c256c 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -1705,28 +1705,30 @@ ModulePass *llvm::createIPSCCPPass() { } -static bool AddressIsTaken(GlobalValue *GV) { +static bool AddressIsTaken(const GlobalValue *GV) { // Delete any dead constantexpr klingons. GV->removeDeadConstantUsers(); - for (Value::use_iterator UI = GV->use_begin(), E = GV->use_end(); - UI != E; ++UI) - if (StoreInst *SI = dyn_cast(*UI)) { + for (Value::use_const_iterator UI = GV->use_begin(), E = GV->use_end(); + UI != E; ++UI) { + const User *U = *UI; + if (const StoreInst *SI = dyn_cast(U)) { if (SI->getOperand(0) == GV || SI->isVolatile()) return true; // Storing addr of GV. - } else if (isa(*UI) || isa(*UI)) { + } else if (isa(U) || isa(U)) { // Make sure we are calling the function, not passing the address. if (UI.getOperandNo() != 0) return true; - } else if (LoadInst *LI = dyn_cast(*UI)) { + } else if (const LoadInst *LI = dyn_cast(U)) { if (LI->isVolatile()) return true; - } else if (isa(*UI)) { + } else if (isa(U)) { // blockaddress doesn't take the address of the function, it takes addr // of label. } else { return true; } + } return false; }