[lld] r228069 - Avoid two function calls of file() when not needed.
Sean Silva
chisophugis at gmail.com
Tue Feb 3 16:00:42 PST 2015
Why can't you just move the entire declaration down?
-- Sean Silva
On Tue, Feb 3, 2015 at 3:44 PM, Davide Italiano <davide at freebsd.org> wrote:
> Author: davide
> Date: Tue Feb 3 17:44:33 2015
> New Revision: 228069
>
> URL: http://llvm.org/viewvc/llvm-project?rev=228069&view=rev
> Log:
> Avoid two function calls of file() when not needed.
>
> Reported by: ruiu
>
> Modified:
> lld/trunk/lib/Core/DefinedAtom.cpp
>
> Modified: lld/trunk/lib/Core/DefinedAtom.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/DefinedAtom.cpp?rev=228069&r1=228068&r2=228069&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/Core/DefinedAtom.cpp (original)
> +++ lld/trunk/lib/Core/DefinedAtom.cpp Tue Feb 3 17:44:33 2015
> @@ -83,12 +83,15 @@ DefinedAtom::ContentPermissions DefinedA
>
> bool DefinedAtom::compareByPosition(const DefinedAtom *lhs,
> const DefinedAtom *rhs) {
> - const File *lhsFile = &lhs->file();
> - const File *rhsFile = &rhs->file();
> + const File *lhsFile;
> + const File *rhsFile;
>
> if (lhs == rhs)
> return false;
>
> + lhsFile = &lhs->file();
> + rhsFile = &rhs->file();
> +
> if (lhsFile->ordinal() != rhsFile->ordinal())
> return lhsFile->ordinal() < rhsFile->ordinal();
> assert(lhs->ordinal() != rhs->ordinal());
>
>
> _______________________________________________
> 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/20150203/f03bba9b/attachment.html>
More information about the llvm-commits
mailing list