[PATCH] D21403: Revert "[IR] Copy comdats in GlobalObject::copyAttributesFrom" (D20631, rL270743)

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 13:35:58 PDT 2016


rnk added a comment.

This patch should fix DAE:

  diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
  index d9da5e8..3caaa4a 100644
  --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
  +++ b/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.


================
Comment at: test/Transforms/DeadArgElim/comdat.ll:1
@@ -1,2 @@
-; RUN: opt -S < %s -deadargelim | FileCheck %s
-
----------------
Please keep this test case and fix DAE


http://reviews.llvm.org/D21403





More information about the llvm-commits mailing list