summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/IR/Globals.cpp1
-rw-r--r--llvm/lib/Linker/IRMover.cpp5
-rw-r--r--llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp2
3 files changed, 2 insertions, 6 deletions
diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp
index c5e1b9b9fa0..6715484518a 100644
--- a/llvm/lib/IR/Globals.cpp
+++ b/llvm/lib/IR/Globals.cpp
@@ -96,7 +96,6 @@ void GlobalObject::copyAttributesFrom(const GlobalValue *Src) {
if (const auto *GV = dyn_cast<GlobalObject>(Src)) {
setAlignment(GV->getAlignment());
setSection(GV->getSection());
- setComdat(const_cast<GlobalObject *>(GV)->getComdat());
}
}
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index 14b0a43030d..7d09b7be868 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -637,11 +637,6 @@ GlobalValue *IRLinker::copyGlobalValueProto(const GlobalValue *SGV,
NewGV->copyAttributesFrom(SGV);
- // Don't copy the comdat, it's from the original module. We'll handle it
- // later.
- if (auto *NewGO = dyn_cast<GlobalObject>(NewGV))
- NewGO->setComdat(nullptr);
-
// Remove these copied constants in case this stays a declaration, since
// they point to the source module. If the def is linked the values will
// be mapped in during linkFunctionBody.
diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
index d9da5e89321..3caaa4a3218 100644
--- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -147,6 +147,7 @@ bool DeadArgumentEliminationPass::DeleteDeadVarargs(Function &Fn) {
// Create the new function body and insert it into the module...
Function *NF = Function::Create(NFTy, Fn.getLinkage());
NF->copyAttributesFrom(&Fn);
+ NF->setComdat(Fn.getComdat());
Fn.getParent()->getFunctionList().insert(Fn.getIterator(), NF);
NF->takeName(&Fn);
@@ -813,6 +814,7 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
// Create the new function body and insert it into the module...
Function *NF = Function::Create(NFTy, F->getLinkage());
NF->copyAttributesFrom(F);
+ NF->setComdat(F->getComdat());
NF->setAttributes(NewPAL);
// Insert the new function before the old function, so we won't be processing
// it again.
OpenPOWER on IntegriCloud