[lld] r196884 - Skip the body of a loop as early as possible.

Rui Ueyama ruiu at google.com
Mon Dec 9 22:32:21 PST 2013


Author: ruiu
Date: Tue Dec 10 00:32:21 2013
New Revision: 196884

URL: http://llvm.org/viewvc/llvm-project?rev=196884&view=rev
Log:
Skip the body of a loop as early as possible.

Modified:
    lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp

Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=196884&r1=196883&r2=196884&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Tue Dec 10 00:32:21 2013
@@ -504,6 +504,10 @@ void AtomChunk::applyRelocations(uint8_t
   for (const auto *layout : _atomLayouts) {
     const DefinedAtom *atom = cast<DefinedAtom>(layout->_atom);
     for (const Reference *ref : *atom) {
+      // Skip if this reference is not for relocation.
+      if (ref->kind() < lld::Reference::kindTargetLow)
+        continue;
+
       auto relocSite32 = reinterpret_cast<ulittle32_t *>(
           fileBuffer + layout->_fileOffset + ref->offsetInAtom());
       auto relocSite16 = reinterpret_cast<ulittle16_t *>(relocSite32);
@@ -512,10 +516,6 @@ void AtomChunk::applyRelocations(uint8_t
       // site.
       targetAddr += *relocSite32;
 
-      // Skip if this reference is not for relocation.
-      if (ref->kind() < lld::Reference::kindTargetLow)
-        continue;
-
       switch (ref->kind()) {
       case llvm::COFF::IMAGE_REL_I386_ABSOLUTE:
         // This relocation is no-op.





More information about the llvm-commits mailing list