[llvm] r324335 - [DeadArgumentElim] Set pointer to DISubprogram before calling RAUW. NFC

Petar Jovanovic via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 03:11:29 PST 2018


Author: petarj
Date: Tue Feb  6 03:11:28 2018
New Revision: 324335

URL: http://llvm.org/viewvc/llvm-project?rev=324335&view=rev
Log:
[DeadArgumentElim] Set pointer to DISubprogram before calling RAUW. NFC

It is better to update pointer of the DISuprogram before we call RAUW for
still live arguments of the function, because with the change reviewed in
D42541 in RAUW we compare DISubprograms rather than functions itself.

Patch by Djordje Todorovic.

Differential Revision: https://reviews.llvm.org/D42794

Modified:
    llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp

Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=324335&r1=324334&r2=324335&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Tue Feb  6 03:11:28 2018
@@ -825,6 +825,9 @@ bool DeadArgumentEliminationPass::Remove
   F->getParent()->getFunctionList().insert(F->getIterator(), NF);
   NF->takeName(F);
 
+  // Patch the pointer to LLVM function in debug info descriptor.
+  NF->setSubprogram(F->getSubprogram());
+
   // Loop over all of the callers of the function, transforming the call sites
   // to pass in a smaller number of arguments into the new function.
   std::vector<Value*> Args;
@@ -1017,9 +1020,6 @@ bool DeadArgumentEliminationPass::Remove
         BB.getInstList().erase(RI);
       }
 
-  // Patch the pointer to LLVM function in debug info descriptor.
-  NF->setSubprogram(F->getSubprogram());
-
   // Now that the old function is dead, delete it.
   F->eraseFromParent();
 




More information about the llvm-commits mailing list