[PATCH] D42715: LTO: Drop comdats when converting definitions to declarations.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 18:55:23 PST 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL323844: LTO: Drop comdats when converting definitions to declarations. (authored by pcc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D42715?vs=132068&id=132093#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42715

Files:
  llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
  llvm/trunk/test/LTO/Resolution/X86/not-prevailing.ll


Index: llvm/trunk/test/LTO/Resolution/X86/not-prevailing.ll
===================================================================
--- llvm/trunk/test/LTO/Resolution/X86/not-prevailing.ll
+++ llvm/trunk/test/LTO/Resolution/X86/not-prevailing.ll
@@ -24,7 +24,8 @@
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-define weak i32 @foo() {
+$foo = comdat any
+define weak i32 @foo() comdat {
   ret i32 65
 }
 
Index: llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
+++ llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
@@ -618,10 +618,12 @@
   if (Function *F = dyn_cast<Function>(&GV)) {
     F->deleteBody();
     F->clearMetadata();
+    F->setComdat(nullptr);
   } else if (GlobalVariable *V = dyn_cast<GlobalVariable>(&GV)) {
     V->setInitializer(nullptr);
     V->setLinkage(GlobalValue::ExternalLinkage);
     V->clearMetadata();
+    V->setComdat(nullptr);
   } else
     // For now we don't resolve or drop aliases. Once we do we'll
     // need to add support here for creating either a function or


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42715.132093.patch
Type: text/x-patch
Size: 1186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180131/2701edd9/attachment.bin>


More information about the llvm-commits mailing list