diff options
author | Simon Tatham <simon.tatham@arm.com> | 2019-03-12 09:28:19 +0000 |
---|---|---|
committer | Simon Tatham <simon.tatham@arm.com> | 2019-03-12 09:28:19 +0000 |
commit | cdb7c31f0adaa9fb338ec1a226cfd44cd9d31c5d (patch) | |
tree | b6ea6777eb8c892319f12063872cd482da365607 /llvm/lib/TableGen | |
parent | c965d21f3318cbe9f7140ca33fda4dfb8b5212bb (diff) | |
download | bcm5719-llvm-cdb7c31f0adaa9fb338ec1a226cfd44cd9d31c5d.tar.gz bcm5719-llvm-cdb7c31f0adaa9fb338ec1a226cfd44cd9d31c5d.zip |
[TableGen] Allow 2^63-1 and 2^63-2 as int literals.
These two values correspond to the 'Empty' and 'Tombstone' special
keys defined by DenseMapInfo<int64_t>, which means that neither one
can be used as a key in DenseMap<int64_t, anything>. Hence, if you try
to use either of those values as an int literal, IntInit::get() fails
an assertion when it tries to insert them into its static cache of
int-literal objects.
Fixed by replacing the DenseMap with a std::map, which doesn't intrude
on the space of legal values of the key type.
Reviewers: nhaehnle, hfinkel, javedabsar, efriedma
Reviewed By: efriedma
Subscribers: fhahn, efriedma, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59016
llvm-svn: 355900
Diffstat (limited to 'llvm/lib/TableGen')
-rw-r--r-- | llvm/lib/TableGen/Record.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp index 4222a0b57fb..7577f0b8571 100644 --- a/llvm/lib/TableGen/Record.cpp +++ b/llvm/lib/TableGen/Record.cpp @@ -32,6 +32,7 @@ #include <cassert> #include <cstdint> #include <memory> +#include <map> #include <string> #include <utility> #include <vector> @@ -457,7 +458,7 @@ Init *BitsInit::resolveReferences(Resolver &R) const { } IntInit *IntInit::get(int64_t V) { - static DenseMap<int64_t, IntInit*> ThePool; + static std::map<int64_t, IntInit*> ThePool; IntInit *&I = ThePool[V]; if (!I) I = new(Allocator) IntInit(V); |