aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2018-03-16 23:51:33 +0000
committerYi Kong <yikong@google.com>2018-03-27 16:42:47 -0700
commit34361f192e41ed6e4e8f9aca80a4ea7e9856f327 (patch)
tree22239413e10fe41d204959abec8830e71f46e03d
parent5154c3238e4c7df6c62294dd338e76a3afb9a621 (diff)
downloadllvm-r316199.tar.gz
[GlobalsAA] Fix a pretty terrible bug that has been in GlobalsAA forllvm-r316199
a long time. The key thing is that we need to create value handles for every function that we create a `FunctionInfo` object around. Without this, when that function is deleted we can end up creating a new function that collides with its address and look up a stale AA result. With that AA result we can in turn miscompile code in ways that break. This is seriously one of the most absurd miscompiles I've seen. It only reproduced for us recently and only when building a very large server with both ThinLTO and PGO. A *HUGE* shout out to Wei Mi who tracked all of this down and came up with this patch. I'm just landing it because I happened to still by at a computer. He or I can work on crafting a test case to hit this (now that we know what to target) but it'll take a while, and we've been chasing this for a long time and need it fix Right Now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327761 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/GlobalsModRef.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Analysis/GlobalsModRef.cpp b/lib/Analysis/GlobalsModRef.cpp
index 4ef023379bb..1e11f4e2ec7 100644
--- a/lib/Analysis/GlobalsModRef.cpp
+++ b/lib/Analysis/GlobalsModRef.cpp
@@ -487,6 +487,8 @@ void GlobalsAAResult::AnalyzeCallGraph(CallGraph &CG, Module &M) {
}
FunctionInfo &FI = FunctionInfos[F];
+ Handles.emplace_front(*this, F);
+ Handles.front().I = Handles.begin();
bool KnowNothing = false;
// Collect the mod/ref properties due to called functions. We only compute