[llvm] r240341 - Linker: Do not expect comdat to exist in source module.

Peter Collingbourne peter at pcc.me.uk
Mon Jun 22 14:46:51 PDT 2015


Author: pcc
Date: Mon Jun 22 16:46:51 2015
New Revision: 240341

URL: http://llvm.org/viewvc/llvm-project?rev=240341&view=rev
Log:
Linker: Do not expect comdat to exist in source module.

Added:
    llvm/trunk/test/Linker/comdat10.ll
Modified:
    llvm/trunk/lib/Linker/LinkModules.cpp

Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=240341&r1=240340&r2=240341&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Mon Jun 22 16:46:51 2015
@@ -1573,8 +1573,8 @@ bool ModuleLinker::run() {
     if (C.getSelectionKind() == Comdat::Any)
       continue;
     const GlobalValue *GV = SrcM->getNamedValue(C.getName());
-    assert(GV);
-    MapValue(GV, ValueMap, RF_None, &TypeMap, &ValMaterializer);
+    if (GV)
+      MapValue(GV, ValueMap, RF_None, &TypeMap, &ValMaterializer);
   }
 
   // Strip replaced subprograms before mapping any metadata -- so that we're

Added: llvm/trunk/test/Linker/comdat10.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/comdat10.ll?rev=240341&view=auto
==============================================================================
--- llvm/trunk/test/Linker/comdat10.ll (added)
+++ llvm/trunk/test/Linker/comdat10.ll Mon Jun 22 16:46:51 2015
@@ -0,0 +1,6 @@
+; RUN: llvm-link %s /dev/null -S -o - | FileCheck %s
+
+$c = comdat largest
+
+; CHECK: @c = global i32 0, comdat
+ at c = global i32 0, comdat





More information about the llvm-commits mailing list