[ThinLTO] Fix FunctionImport alias checking and test

Skip imports for weak_any aliases as well. Fix the test to check
non-import of weak aliases and functions, and import of normal alias.

llvm-svn: 253991
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index 7257967..c874e4f 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -142,11 +142,12 @@
       llvm_unreachable("Can't load function in Module");
     }
 
-    // We cannot import weak_any functions without possibly affecting the
-    // order they are seen and selected by the linker, changing program
+    // We cannot import weak_any functions/aliases without possibly affecting
+    // the order they are seen and selected by the linker, changing program
     // semantics.
-    if (F->hasWeakAnyLinkage()) {
-      DEBUG(dbgs() << "Ignoring import request for weak-any function "
+    if (SGV->hasWeakAnyLinkage()) {
+      DEBUG(dbgs() << "Ignoring import request for weak-any "
+                   << (isa<Function>(SGV) ? "function " : "alias ")
                    << CalledFunctionName << " from " << FileName << "\n");
       continue;
     }