From 0591c5d719eccc127dae01ea4f586dc5c6e89478 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Mon, 5 Oct 2015 17:26:36 +0000 Subject: MergeFunctions: Clear GlobalNumbers ValueMap Otherwise, the map will observe changes as long as MergeFunctions is alive. This is bad because follow-up passes could replace-all-uses-with on the key of an entry in the map. The value handle callback of ValueMap however asserts that the key type matches. rdar://22971893 llvm-svn: 249327 --- llvm/lib/Transforms/IPO/MergeFunctions.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/Transforms') diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp index 2b0bcdff72f..d7bfed105a9 100644 --- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp +++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp @@ -164,6 +164,9 @@ class GlobalNumberState { NextNumber++; return MapIter->second; } + void clear() { + GlobalNumbers.clear(); + } }; /// FunctionComparator - Compares two functions to determine whether or not @@ -1546,6 +1549,7 @@ bool MergeFunctions::runOnModule(Module &M) { } while (!Deferred.empty()); FnTree.clear(); + GlobalNumbers.clear(); return Changed; } -- cgit v1.2.3