Move definition closer to use. NFC.
[oota-llvm.git] / lib / Linker / LinkModules.cpp
index 2692ec97b7826f32c94c5b7987b8a85b472ba8cc..f98822103cd00fd80122cb8d7f32cb2078f607bf 100644 (file)
@@ -690,9 +690,6 @@ bool ModuleLinker::shouldLinkFromSource(bool &LinkFromSrc,
   bool SrcIsDeclaration = Src.isDeclarationForLinker();
   bool DestIsDeclaration = Dest.isDeclarationForLinker();
 
-  // FIXME: Make datalayout mandatory and just use getDataLayout().
-  DataLayout DL(Dest.getParent());
-
   if (SrcIsDeclaration) {
     // If Src is external or if both Src & Dest are external..  Just link the
     // external globals, we aren't adding anything.
@@ -723,6 +720,9 @@ bool ModuleLinker::shouldLinkFromSource(bool &LinkFromSrc,
       return false;
     }
 
+    // FIXME: Make datalayout mandatory and just use getDataLayout().
+    DataLayout DL(Dest.getParent());
+
     uint64_t DestSize = DL.getTypeAllocSize(Dest.getType()->getElementType());
     uint64_t SrcSize = DL.getTypeAllocSize(Src.getType()->getElementType());
     LinkFromSrc = SrcSize > DestSize;