Index: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp =================================================================== --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -68,7 +68,7 @@ /// arguments, and returns the new function. At this point, we know that it's /// safe to do so. static CallGraphNode * -DoPromotion(Function *F, SmallPtrSetImpl &ArgsToPromote, +doPromotion(Function *F, SmallPtrSetImpl &ArgsToPromote, SmallPtrSetImpl &ByValArgsToTransform, CallGraph &CG) { // Start by computing a new prototype for the function, which is the same as @@ -479,7 +479,7 @@ /// AllCallersPassInValidPointerForArgument - Return true if we can prove that /// all callees pass in a valid pointer for the specified function argument. -static bool AllCallersPassInValidPointerForArgument(Argument *Arg) { +static bool allCallersPassInValidPointerForArgument(Argument *Arg) { Function *Callee = Arg->getParent(); const DataLayout &DL = Callee->getParent()->getDataLayout(); @@ -502,14 +502,14 @@ /// elements in Prefix is the same as the corresponding elements in Longer. /// /// This means it also returns true when Prefix and Longer are equal! -static bool IsPrefix(const IndicesVector &Prefix, const IndicesVector &Longer) { +static bool isPrefix(const IndicesVector &Prefix, const IndicesVector &Longer) { if (Prefix.size() > Longer.size()) return false; return std::equal(Prefix.begin(), Prefix.end(), Longer.begin()); } /// Checks if Indices, or a prefix of Indices, is in Set. -static bool PrefixIn(const IndicesVector &Indices, +static bool prefixIn(const IndicesVector &Indices, std::set &Set) { std::set::iterator Low; Low = Set.upper_bound(Indices); @@ -520,7 +520,7 @@ // prefix exists. // // This load is safe if any prefix of its operands is safe to load. - return Low != Set.end() && IsPrefix(*Low, Indices); + return Low != Set.end() && isPrefix(*Low, Indices); } /// Mark the given indices (ToMark) as safe in the given set of indices @@ -528,7 +528,7 @@ /// is already a prefix of Indices in Safe, Indices are implicitely marked safe /// already. Furthermore, any indices that Indices is itself a prefix of, are /// removed from Safe (since they are implicitely safe because of Indices now). -static void MarkIndicesSafe(const IndicesVector &ToMark, +static void markIndicesSafe(const IndicesVector &ToMark, std::set &Safe) { std::set::iterator Low; Low = Safe.upper_bound(ToMark); @@ -539,7 +539,7 @@ // means it points to a prefix of Indices (possibly Indices itself), if // such prefix exists. if (Low != Safe.end()) { - if (IsPrefix(*Low, ToMark)) + if (isPrefix(*Low, ToMark)) // If there is already a prefix of these indices (or exactly these // indices) marked a safe, don't bother adding these indices return; @@ -552,7 +552,7 @@ ++Low; // If there we're a prefix of longer index list(s), remove those std::set::iterator End = Safe.end(); - while (Low != End && IsPrefix(ToMark, *Low)) { + while (Low != End && isPrefix(ToMark, *Low)) { std::set::iterator Remove = Low; ++Low; Safe.erase(Remove); @@ -597,7 +597,7 @@ GEPIndicesSet ToPromote; // If the pointer is always valid, any load with first index 0 is valid. - if (isByValOrInAlloca || AllCallersPassInValidPointerForArgument(Arg)) + if (isByValOrInAlloca || allCallersPassInValidPointerForArgument(Arg)) SafeToUnconditionallyLoad.insert(IndicesVector(1, 0)); // First, iterate the entry block and mark loads of (geps of) arguments as @@ -623,12 +623,12 @@ return false; // Indices checked out, mark them as safe - MarkIndicesSafe(Indices, SafeToUnconditionallyLoad); + markIndicesSafe(Indices, SafeToUnconditionallyLoad); Indices.clear(); } } else if (V == Arg) { // Direct loads are equivalent to a GEP with a single 0 index. - MarkIndicesSafe(IndicesVector(1, 0), SafeToUnconditionallyLoad); + markIndicesSafe(IndicesVector(1, 0), SafeToUnconditionallyLoad); } } @@ -683,7 +683,7 @@ // Now, see if it is safe to promote this load / loads of this GEP. Loading // is safe if Operands, or a prefix of Operands, is marked as safe. - if (!PrefixIn(Operands, SafeToUnconditionallyLoad)) + if (!prefixIn(Operands, SafeToUnconditionallyLoad)) return false; // See if we are already promoting a load with these indices. If not, check @@ -819,7 +819,7 @@ /// calls the DoPromotion method. /// static CallGraphNode * -PromoteArguments(CallGraphNode *CGN, CallGraph &CG, +promoteArguments(CallGraphNode *CGN, CallGraph &CG, function_ref AARGetter, unsigned MaxElements) { Function *F = CGN->getFunction(); @@ -950,7 +950,7 @@ if (ArgsToPromote.empty() && ByValArgsToTransform.empty()) return nullptr; - return DoPromotion(F, ArgsToPromote, ByValArgsToTransform, CG); + return doPromotion(F, ArgsToPromote, ByValArgsToTransform, CG); } namespace { @@ -1020,7 +1020,7 @@ // Attempt to promote arguments from all functions in this SCC. for (CallGraphNode *OldNode : SCC) { if (CallGraphNode *NewNode = - PromoteArguments(OldNode, CG, AARGetter, MaxElements)) { + promoteArguments(OldNode, CG, AARGetter, MaxElements)) { LocalChange = true; SCC.ReplaceNode(OldNode, NewNode); }