diff options
author | whitequark <whitequark@whitequark.org> | 2017-10-19 04:47:48 +0000 |
---|---|---|
committer | whitequark <whitequark@whitequark.org> | 2017-10-19 04:47:48 +0000 |
commit | 1fd7e8c37af621d75b191deec9721b23ca36c9ea (patch) | |
tree | d90eb91916331083f56b76aae21e7f10a47ed6bf /include | |
parent | 9db44d0441bfb543394da712c17268a89029c4c2 (diff) | |
download | llvm-1fd7e8c37af621d75b191deec9721b23ca36c9ea.tar.gz |
[MergeFunctions] Don't blindly RAUW a GlobalValue with a ConstantExpr.
MergeFunctions uses (through FunctionComparator) a map of GlobalValues
to identifiers because it needs to compare functions and globals
do not have an inherent total order. Thus, FunctionComparator
(through GlobalNumberState) has a ValueMap<GlobalValue *>.
r315852 added a RAUW on globals that may have been previously
encountered by the FunctionComparator, which would replace
a GlobalValue * key with a ConstantExpr *, which is illegal.
This commit adjusts that code path to remove the function being
replaced from the ValueMap as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316145 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Transforms/Utils/FunctionComparator.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/llvm/Transforms/Utils/FunctionComparator.h b/include/llvm/Transforms/Utils/FunctionComparator.h index e0c79a1027e..7698a068717 100644 --- a/include/llvm/Transforms/Utils/FunctionComparator.h +++ b/include/llvm/Transforms/Utils/FunctionComparator.h @@ -78,6 +78,10 @@ public: return MapIter->second; } + void erase(GlobalValue *Global) { + GlobalNumbers.erase(Global); + } + void clear() { GlobalNumbers.clear(); } |