summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-09-13 21:29:45 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-09-13 21:29:45 +0000
commitb3e9681cc0ea2d52a1f8cd09880656780dce4073 (patch)
tree85bca0787d033dd6205c4c9a4e2783de000078ad /lib
parent12b0179c14badcd2c50d4b6b33138bf9905cc1f8 (diff)
downloadllvm-b3e9681cc0ea2d52a1f8cd09880656780dce4073.tar.gz
llvm-b3e9681cc0ea2d52a1f8cd09880656780dce4073.tar.bz2
llvm-b3e9681cc0ea2d52a1f8cd09880656780dce4073.tar.xz
Let's just declare that it is impossible to construct a std::pair from a null
pointer and work around that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113788 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SplitKit.cpp33
1 files changed, 11 insertions, 22 deletions
diff --git a/lib/CodeGen/SplitKit.cpp b/lib/CodeGen/SplitKit.cpp
index 29474f0d55..5de7688c68 100644
--- a/lib/CodeGen/SplitKit.cpp
+++ b/lib/CodeGen/SplitKit.cpp
@@ -339,6 +339,13 @@ bool SplitAnalysis::getMultiUseBlocks(BlockPtrSet &Blocks) {
// LiveIntervalMap
//===----------------------------------------------------------------------===//
+// Work around the fact that the std::pair constructors are broken for pointer
+// pairs in some implementations. makeVV(x, 0) works.
+static inline std::pair<const VNInfo*, VNInfo*>
+makeVV(const VNInfo *a, VNInfo *b) {
+ return std::make_pair(a, b);
+}
+
// defValue - Introduce a li_ def for ParentVNI that could be later than
// ParentVNI->def.
VNInfo *LiveIntervalMap::defValue(const VNInfo *ParentVNI, SlotIndex Idx) {
@@ -351,19 +358,9 @@ VNInfo *LiveIntervalMap::defValue(const VNInfo *ParentVNI, SlotIndex Idx) {
return mapValue(ParentVNI, Idx);
// This is a complex def. Mark with a NULL in valueMap.
- VNInfo *OldVNI =
- valueMap_.insert(
- ValueMap::value_type(ParentVNI, static_cast<VNInfo *>(0))).first->second;
- // The static_cast<VNInfo *> is only needed to work around a bug in an
- // old version of the C++0x standard which the following compilers
- // implemented and have yet to fix:
- //
- // Microsoft Visual Studio 2010 Version 10.0.30319.1 RTMRel
- // Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01
- //
- // If/When we move to C++0x, this can be replaced by nullptr.
- (void)OldVNI;
- assert(OldVNI == 0 && "Simple/Complex values mixed");
+ VNInfo *&OldVNI = valueMap_[ParentVNI];
+ assert(!OldVNI && "Simple/Complex values mixed");
+ OldVNI = 0;
// Should we insert a minimal snippet of VNI LiveRange, or can we count on
// callers to do that? We need it for lookups of complex values.
@@ -380,15 +377,7 @@ VNInfo *LiveIntervalMap::mapValue(const VNInfo *ParentVNI, SlotIndex Idx) {
// Use insert for lookup, so we can add missing values with a second lookup.
std::pair<ValueMap::iterator,bool> InsP =
- valueMap_.insert(ValueMap::value_type(ParentVNI, static_cast<VNInfo *>(0)));
- // The static_cast<VNInfo *> is only needed to work around a bug in an
- // old version of the C++0x standard which the following compilers
- // implemented and have yet to fix:
- //
- // Microsoft Visual Studio 2010 Version 10.0.30319.1 RTMRel
- // Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01
- //
- // If/When we move to C++0x, this can be replaced by nullptr.
+ valueMap_.insert(makeVV(ParentVNI, 0));
// This was an unknown value. Create a simple mapping.
if (InsP.second)