[PATCH] D21403: Revert "[IR] Copy comdats in GlobalObject::copyAttributesFrom" (D20631, rL270743)
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 15 13:53:46 PDT 2016
jlebar updated this revision to Diff 60901.
jlebar added a comment.
Fix DAE.
http://reviews.llvm.org/D21403
Files:
lib/IR/Globals.cpp
lib/Linker/IRMover.cpp
lib/Transforms/IPO/DeadArgumentElimination.cpp
Index: lib/Transforms/IPO/DeadArgumentElimination.cpp
===================================================================
--- lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -147,6 +147,7 @@
// 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 @@
// 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.
Index: lib/Linker/IRMover.cpp
===================================================================
--- lib/Linker/IRMover.cpp
+++ lib/Linker/IRMover.cpp
@@ -637,11 +637,6 @@
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.
Index: lib/IR/Globals.cpp
===================================================================
--- lib/IR/Globals.cpp
+++ lib/IR/Globals.cpp
@@ -96,7 +96,6 @@
if (const auto *GV = dyn_cast<GlobalObject>(Src)) {
setAlignment(GV->getAlignment());
setSection(GV->getSection());
- setComdat(const_cast<GlobalObject *>(GV)->getComdat());
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21403.60901.patch
Type: text/x-patch
Size: 1807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160615/6b824834/attachment.bin>
More information about the llvm-commits
mailing list