diff options
author | Davide Italiano <davide@freebsd.org> | 2015-02-03 23:44:33 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2015-02-03 23:44:33 +0000 |
commit | 836a63576433da671135fbfaaf1b3108c1e2383c (patch) | |
tree | d5ae0c125bde7b45745502c44d23b62079251f82 | |
parent | 10797c57070ac9ea2b8eb5e4a2b76f997b079bbe (diff) | |
download | bcm5719-llvm-836a63576433da671135fbfaaf1b3108c1e2383c.tar.gz bcm5719-llvm-836a63576433da671135fbfaaf1b3108c1e2383c.zip |
Avoid two function calls of file() when not needed.
Reported by: ruiu
llvm-svn: 228069
-rw-r--r-- | lld/lib/Core/DefinedAtom.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lld/lib/Core/DefinedAtom.cpp b/lld/lib/Core/DefinedAtom.cpp index fd9f23d7fba..bb884771b08 100644 --- a/lld/lib/Core/DefinedAtom.cpp +++ b/lld/lib/Core/DefinedAtom.cpp @@ -83,12 +83,15 @@ DefinedAtom::ContentPermissions DefinedAtom::permissions(ContentType type) { 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()); |