[lld] r228069 - Avoid two function calls of file() when not needed.
Davide Italiano
davide at freebsd.org
Tue Feb 3 15:44:33 PST 2015
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());
More information about the llvm-commits
mailing list