[lld] r328811 - Exit early from a loop. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 29 11:29:12 PDT 2018


Author: ruiu
Date: Thu Mar 29 11:29:12 2018
New Revision: 328811

URL: http://llvm.org/viewvc/llvm-project?rev=328811&view=rev
Log:
Exit early from a loop. NFC.

This patch fixes an issue introduced in r328810 which made the algorithm
to always run the loop O(n^2) times, though we can break early. The
output remains the same.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=328811&r1=328810&r2=328811&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Mar 29 11:29:12 2018
@@ -2002,7 +2002,7 @@ static void checkOverlap(StringRef Name,
       OutputSection *Other = Sections[J].Sec;
       uint64_t OtherStart = Sections[J].Offset;
       if (Start + Sec->Size <= OtherStart)
-        continue;
+        break;
 
       errorOrWarn("section " + Sec->Name + " " + Name +
                   " range overlaps with " + Other->Name + "\n>>> " + Sec->Name +




More information about the llvm-commits mailing list