Skip the body of a loop as early as possible.

llvm-svn: 196884
This commit is contained in:
Rui Ueyama 2013-12-10 06:32:21 +00:00
parent c53b3b0809
commit 906d93432e
1 changed files with 4 additions and 4 deletions

View File

@ -504,6 +504,10 @@ void AtomChunk::applyRelocations(uint8_t *fileBuffer,
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 *fileBuffer,
// 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.