[llvm] r310164 - [LCG] When removing a dead function and clearing out the data

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 4 20:37:39 PDT 2017


Author: chandlerc
Date: Fri Aug  4 20:37:39 2017
New Revision: 310164

URL: http://llvm.org/viewvc/llvm-project?rev=310164&view=rev
Log:
[LCG] When removing a dead function and clearing out the data
structures, actually null out the graph pointers as well. We won't ever
update these, and we certainly shouldn't be calling any methods on them,
so it seems good to defensively nuke them.

Modified:
    llvm/trunk/lib/Analysis/LazyCallGraph.cpp

Modified: llvm/trunk/lib/Analysis/LazyCallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyCallGraph.cpp?rev=310164&r1=310163&r2=310164&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyCallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyCallGraph.cpp Fri Aug  4 20:37:39 2017
@@ -1672,8 +1672,10 @@ void LazyCallGraph::removeDeadFunction(F
   // Finally clear out all the data structures from the node down through the
   // components.
   N.clear();
+  N.G = nullptr;
   C.clear();
   RC.clear();
+  RC.G = nullptr;
 
   // Nothing to delete as all the objects are allocated in stable bump pointer
   // allocators.




More information about the llvm-commits mailing list