OSDN Git Service

Add a new insert_as() method to DenseMap and use it for ConstantUniqueMap
authorMehdi Amini <mehdi.amini@apple.com>
Wed, 10 Feb 2016 23:07:29 +0000 (23:07 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Wed, 10 Feb 2016 23:07:29 +0000 (23:07 +0000)
commitf181d046e032151092f7d580264f9c05a324ca73
treee049dbb9a5225b1130db2650d40f5380d69b880c
parentde48097969d47f3a213777160ff435c66abba7e2
Add a new insert_as() method to DenseMap and use it for ConstantUniqueMap

Summary:
Just like the existing find_as() method, the new insert_as() accepts
an extra parameter which is used as a key to find the bucket in the
map.
When creating a Constant, we want to check the map before actually
creating the object. In this case we have to perform two queries to
the map, and this extra parameter can save recomputing the hash value
for the second query.

Reviewers: dexonsmith, chandlerc

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D16268

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260458 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/DenseMap.h
lib/IR/ConstantsContext.h