[ThinLTO] Handle an external call from an import to an alias in dest
[oota-llvm.git] / lib / Transforms / IPO / FunctionImport.cpp
index 11418edbf7bc1634f4d42717e17843612cd55225..5e0df95051192fe9464756682346677f5529e371 100644 (file)
@@ -133,6 +133,8 @@ static void findExternalCalls(const Module &DestModule, Function &F,
         // Ignore functions already present in the destination module
         auto *SrcGV = DestModule.getNamedValue(ImportedName);
         if (SrcGV) {
+          if (GlobalAlias *SGA = dyn_cast<GlobalAlias>(SrcGV))
+            SrcGV = SGA->getBaseObject();
           assert(isa<Function>(SrcGV) && "Name collision during import");
           if (!cast<Function>(SrcGV)->isDeclaration()) {
             DEBUG(dbgs() << DestModule.getModuleIdentifier() << ": Ignoring "