]> granicus.if.org Git - llvm/commit
IR: Rewrite ConstantUniqueMap
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 19 Aug 2014 00:42:32 +0000 (00:42 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 19 Aug 2014 00:42:32 +0000 (00:42 +0000)
commit78c0b35bf7e5d9093c94f811a7e8c72f0a6357df
tree234bb42e58e4372cdb2c044957b0a685c354109e
parent79f9f85c04e1ed29670ed7a87df879bb5b42a0f1
IR: Rewrite ConstantUniqueMap

Rewrite `ConstantUniqueMap` to be more similar to
`ConstantAggrUniqueMap`.

  - Use a `DenseMap` with custom MapInfo instead of a `std::map` with
    linear lookups and deletion.
  - Don't waste memory explicitly storing (heavyweight) keys.

Only `ConstantExpr` and `InlineAsm` actually use this data structure, so
I also updated them to use it.

This code cleanup is a precursor to reducing RAUW traffic on
`ConstantExpr` -- I felt badly adding a new (linear) call to
`ConstantUniqueMap::FindExistingKey`, so this designs away the concern.

A follow-up commit will transition the users of `ConstantAggrUniqueMap`
over.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215957 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/InlineAsm.h
lib/IR/Constants.cpp
lib/IR/ConstantsContext.h
lib/IR/LLVMContextImpl.cpp
lib/IR/LLVMContextImpl.h