[PATCH] D44593: [GlobalAA] Create DeletionCallbackHandle whenever a function is inserted into FunctionInfos

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 16 16:57:02 PDT 2018


wmi created this revision.
wmi added reviewers: chandlerc, sanjoy.
Herald added a subscriber: mehdi_amini.

DeletionCallbackHandle is used to remove stale GlobalAA information whenever a Function or GlobalValue is deleted.  In GlobalsAAResult::AnalyzeCallGraph, we failed to do that for functions inserted into DenseMap FunctionInfos, so after those functions are deleted, there are stale entries inside of FunctionInfos. More seriously, FunctionInfos contains pairs from function pointer to ModRefInfo. If the deleted function space is reallocated to a new function, we will get wrong mod ref information for the new function from GlobalAA. The patch fixed it by creating DeletionCallbackHandle when a function is inserted into FunctionInfos.

The issue is exposed as a runtime failure in a big application, only when compiler is built in release mode, and when thinlto and new pass manager is used to build the application. So I havn't got a way to get a small testcase.


Repository:
  rL LLVM

https://reviews.llvm.org/D44593

Files:
  lib/Analysis/GlobalsModRef.cpp


Index: lib/Analysis/GlobalsModRef.cpp
===================================================================
--- lib/Analysis/GlobalsModRef.cpp
+++ lib/Analysis/GlobalsModRef.cpp
@@ -503,6 +503,8 @@
 
     FunctionInfo &FI = FunctionInfos[F];
     bool KnowNothing = false;
+    Handles.emplace_front(*this, F);
+    Handles.front().I = Handles.begin();
 
     // Collect the mod/ref properties due to called functions.  We only compute
     // one mod-ref set.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44593.138796.patch
Type: text/x-patch
Size: 459 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180316/0a446e74/attachment.bin>


More information about the llvm-commits mailing list