]> granicus.if.org Git - clang/commitdiff
Re-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in the module...
authorPeter Collingbourne <peter@pcc.me.uk>
Thu, 4 May 2017 18:03:25 +0000 (18:03 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 4 May 2017 18:03:25 +0000 (18:03 +0000)
with a fix for the clang backend.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302176 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/BackendUtil.cpp
test/CodeGen/thinlto_backend.ll

index 03883805199f4208efa75677b3386c25ea125aa4..aa5b5267abd2e03d50f878f09c29b22d8b3fc4bd 100644 (file)
@@ -974,10 +974,14 @@ static void runThinLTOBackend(ModuleSummaryIndex *CombinedIndex, Module *M,
   // via a WriteIndexesThinBackend.
   FunctionImporter::ImportMapTy ImportList;
   for (auto &GlobalList : *CombinedIndex) {
+    // Ignore entries for undefined references.
+    if (GlobalList.second.SummaryList.empty())
+      continue;
+
     auto GUID = GlobalList.first;
-    assert(GlobalList.second.size() == 1 &&
+    assert(GlobalList.second.SummaryList.size() == 1 &&
            "Expected individual combined index to have one summary per GUID");
-    auto &Summary = GlobalList.second[0];
+    auto &Summary = GlobalList.second.SummaryList[0];
     // Skip the summaries for the importing module. These are included to
     // e.g. record required linkage changes.
     if (Summary->modulePath() == M->getModuleIdentifier())
index ac0b3b76ef7d1c0d3bfbf70b3a2dfdd0a729018f..813bb62c1a291b7458c760e60fc92fb41b37123d 100644 (file)
@@ -35,8 +35,12 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 declare void @f2()
+declare i8* @f3()
 
 define void @f1() {
   call void @f2()
+  ; Make sure that the backend can handle undefined references.
+  ; Do an indirect call so that the undefined ref shows up in the combined index.
+  call void bitcast (i8*()* @f3 to void()*)()
   ret void
 }