From fcad6bdc17124ae1e4b93bd405a95c79c365f55d Mon Sep 17 00:00:00 2001 From: Zhongxing Xu Date: Tue, 2 Feb 2010 06:33:32 +0000 Subject: [PATCH] simplify code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95074 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/ImmutableIntervalMap.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/include/llvm/ADT/ImmutableIntervalMap.h b/include/llvm/ADT/ImmutableIntervalMap.h index 4cd7db02e96..1ff2ae2644b 100644 --- a/include/llvm/ADT/ImmutableIntervalMap.h +++ b/include/llvm/ADT/ImmutableIntervalMap.h @@ -156,28 +156,25 @@ private: // Current key overlaps with the inserted key. // Remove the current key. Changed = true; - TreeTy *OldNode = T; + data_type_ref OldData = ImutInfo::DataOfValue(Value(T)); T = Remove_internal(CurrentK, T); // Add back the unoverlapped part of the current key. if (CurrentK.getStart() < K.getStart()) { if (CurrentK.getEnd() <= K.getEnd()) { Interval NewK(CurrentK.getStart(), K.getStart()-1); - return Add_internal(std::make_pair(NewK, - ImutInfo::DataOfValue(Value(OldNode))), T); + return Add_internal(std::make_pair(NewK, OldData), T); } else { Interval NewK1(CurrentK.getStart(), K.getStart()-1); - T = Add_internal(std::make_pair(NewK1, - ImutInfo::DataOfValue(Value(OldNode))), T); + T = Add_internal(std::make_pair(NewK1, OldData), T); + Interval NewK2(K.getEnd()+1, CurrentK.getEnd()); - return Add_internal(std::make_pair(NewK2, - ImutInfo::DataOfValue(Value(OldNode))), T); + return Add_internal(std::make_pair(NewK2, OldData), T); } } else { if (CurrentK.getEnd() > K.getEnd()) { Interval NewK(K.getEnd()+1, CurrentK.getEnd()); - return Add_internal(std::make_pair(NewK, - ImutInfo::DataOfValue(Value(OldNode))), T); + return Add_internal(std::make_pair(NewK, OldData), T); } } }