summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-11-28 06:14:33 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-11-28 06:14:33 +0000
commit67d1a71aa4d55c2f82cc9b70f5afc2016e3daf69 (patch)
tree77cc85899467b4664b4022bca91f6d272464b5b2 /llvm
parent739b9cf1047ff875c432b18182adba9882b3422f (diff)
downloadbcm5719-llvm-67d1a71aa4d55c2f82cc9b70f5afc2016e3daf69.tar.gz
bcm5719-llvm-67d1a71aa4d55c2f82cc9b70f5afc2016e3daf69.zip
Speed up simple insertions into an unbranched tree by not creating an iterator.
llvm-svn: 120232
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/ADT/IntervalMap.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/include/llvm/ADT/IntervalMap.h b/llvm/include/llvm/ADT/IntervalMap.h
index 0451a762add..2758cbc562d 100644
--- a/llvm/include/llvm/ADT/IntervalMap.h
+++ b/llvm/include/llvm/ADT/IntervalMap.h
@@ -1128,7 +1128,12 @@ public:
/// It is assumed that no key in the interval is mapped to another value, but
/// overlapping intervals already mapped to y will be coalesced.
void insert(KeyT a, KeyT b, ValT y) {
- find(a).insert(a, b, y);
+ if (branched() || rootSize == RootLeaf::Capacity)
+ return find(a).insert(a, b, y);
+
+ // Easy insert into root leaf.
+ unsigned p = rootLeaf().findFrom(0, rootSize, a);
+ rootSize = rootLeaf().insertFrom(p, rootSize, a, b, y).second;
}
/// clear - Remove all entries.
OpenPOWER on IntegriCloud