[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 16:27:08 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL272855: [IR] [DAE] Copy comdats during DAE, and don't copy comdats in GlobalObject… (authored by jlebar).

Changed prior to commit:
  http://reviews.llvm.org/D21403?vs=60901&id=60929#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21403

Files:
  llvm/trunk/lib/IR/Globals.cpp
  llvm/trunk/lib/Linker/IRMover.cpp
  llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp

Index: llvm/trunk/lib/Linker/IRMover.cpp
===================================================================
--- llvm/trunk/lib/Linker/IRMover.cpp
+++ llvm/trunk/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: llvm/trunk/lib/IR/Globals.cpp
===================================================================
--- llvm/trunk/lib/IR/Globals.cpp
+++ llvm/trunk/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());
   }
 }
 
Index: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ llvm/trunk/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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21403.60929.patch
Type: text/x-patch
Size: 1906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160615/b0a1c6aa/attachment.bin>


More information about the llvm-commits mailing list