[PATCH] D47494: [LowerTypeTests] Discard extern_weak linkage for definitions

Vlad Tsyrklevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 30 15:44:08 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL333604: [LowerTypeTests] Discard extern_weak linkage for definitions (authored by vlad.tsyrklevich, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D47494

Files:
  llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
  llvm/trunk/test/Transforms/LowerTypeTests/pr37625.ll


Index: llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
+++ llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -1716,6 +1716,11 @@
           F->clearMetadata();
         }
 
+        // Update the linkage for extern_weak declarations when a definition
+        // exists.
+        if (Linkage == CFL_Definition && F->hasExternalWeakLinkage())
+          F->setLinkage(GlobalValue::ExternalLinkage);
+
         // If the function in the full LTO module is a declaration, replace its
         // type metadata with the type metadata we found in cfi.functions. That
         // metadata is presumed to be more accurate than the metadata attached
Index: llvm/trunk/test/Transforms/LowerTypeTests/pr37625.ll
===================================================================
--- llvm/trunk/test/Transforms/LowerTypeTests/pr37625.ll
+++ llvm/trunk/test/Transforms/LowerTypeTests/pr37625.ll
@@ -0,0 +1,14 @@
+; RUN: opt -S -lowertypetests -lowertypetests-summary-action=export -lowertypetests-read-summary=%S/Inputs/use-typeid1-typeid2.yaml -lowertypetests-write-summary=%t < %s | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+declare !type !2 extern_weak void @h(i8)
+
+!cfi.functions = !{!0, !1}
+
+!0 = !{!"h", i8 2, !2}
+!1 = !{!"h", i8 0, !2}
+!2 = !{i64 0, !"typeid1"}
+
+; CHECK-DAG: @h = alias void (i8), bitcast


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47494.149211.patch
Type: text/x-patch
Size: 1515 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180530/8ab2afbb/attachment.bin>


More information about the llvm-commits mailing list