[llvm] r323844 - LTO: Drop comdats when converting definitions to declarations.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 30 18:51:03 PST 2018
Author: pcc
Date: Tue Jan 30 18:51:03 2018
New Revision: 323844
URL: http://llvm.org/viewvc/llvm-project?rev=323844&view=rev
Log:
LTO: Drop comdats when converting definitions to declarations.
Differential Revision: https://reviews.llvm.org/D42715
Modified:
llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
llvm/trunk/test/LTO/Resolution/X86/not-prevailing.ll
Modified: llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp?rev=323844&r1=323843&r2=323844&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp Tue Jan 30 18:51:03 2018
@@ -618,10 +618,12 @@ void llvm::convertToDeclaration(GlobalVa
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
Modified: llvm/trunk/test/LTO/Resolution/X86/not-prevailing.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LTO/Resolution/X86/not-prevailing.ll?rev=323844&r1=323843&r2=323844&view=diff
==============================================================================
--- llvm/trunk/test/LTO/Resolution/X86/not-prevailing.ll (original)
+++ llvm/trunk/test/LTO/Resolution/X86/not-prevailing.ll Tue Jan 30 18:51:03 2018
@@ -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
}
More information about the llvm-commits
mailing list