[poolalloc] r238377 - CallTargets: Sort and unique callee lists by function name.
David Blaikie
dblaikie at gmail.com
Wed May 27 16:21:00 PDT 2015
On Wed, May 27, 2015 at 4:03 PM, Will Dietz <wdietz2 at illinois.edu> wrote:
> Author: wdietz2
> Date: Wed May 27 18:03:18 2015
> New Revision: 238377
>
> URL: http://llvm.org/viewvc/llvm-project?rev=238377&view=rev
> Log:
> CallTargets: Sort and unique callee lists by function name.
>
> Modified:
> poolalloc/trunk/lib/DSA/CallTargets.cpp
>
> Modified: poolalloc/trunk/lib/DSA/CallTargets.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/CallTargets.cpp?rev=238377&r1=238376&r2=238377&view=diff
>
> ==============================================================================
> --- poolalloc/trunk/lib/DSA/CallTargets.cpp (original)
> +++ poolalloc/trunk/lib/DSA/CallTargets.cpp Wed May 27 18:03:18 2015
> @@ -162,6 +162,17 @@ void CallTargetFinder<dsa>::print(llvm::
> template<class dsa>
> bool CallTargetFinder<dsa>::runOnModule(Module &M) {
> findIndTargets(M);
> +
> + // Sort callees alphabetically, remove duplicates
> + for(auto &i: IndMap) {
> + auto &callees = i.second;
> + std::sort(callees.begin(), callees.end(),
> + [](const Function *a, const Function *b) {
> + return a->getName() < b->getName();
> + });
> + std::unique(callees.begin(), callees.end());
>
You probably want to call erase(unique(...), end) - otehrwise the
duplicates will still be present, just hiding in the tail of the sequence.
> + }
> +
> return false;
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150527/2fe3c95c/attachment.html>
More information about the llvm-commits
mailing list