tsan: fix COMPAT shadow mapping for new memory allocator


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@162018 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/tsan/rtl/tsan_platform.h b/lib/tsan/rtl/tsan_platform.h
index 00457f5..35906b4 100644
--- a/lib/tsan/rtl/tsan_platform.h
+++ b/lib/tsan/rtl/tsan_platform.h
@@ -28,7 +28,7 @@
 // when memory addresses are of the 0x2axxxxxxxxxx form.
 // The option is enabled with 'setarch x86_64 -L'.
 #elif defined(TSAN_COMPAT_SHADOW) && TSAN_COMPAT_SHADOW
-static const uptr kLinuxAppMemBeg = 0x2a0000000000ULL;
+static const uptr kLinuxAppMemBeg = 0x290000000000ULL;
 static const uptr kLinuxAppMemEnd = 0x7fffffffffffULL;
 #else
 static const uptr kLinuxAppMemBeg = 0x7cf000000000ULL;
@@ -62,9 +62,6 @@
   CHECK(IsShadowMem(shadow));
 #ifdef TSAN_GO
   return (shadow & ~kLinuxShadowMsk) / kShadowCnt;
-#elif defined(TSAN_COMPAT_SHADOW) && TSAN_COMPAT_SHADOW
-  // COMPAT mapping is not quite one-to-one.
-  return (shadow / kShadowCnt) | 0x280000000000ULL;
 #else
   return (shadow / kShadowCnt) | kLinuxAppMemMsk;
 #endif
@@ -72,9 +69,10 @@
 
 // For COMPAT mapping returns an alternative address
 // that mapped to the same shadow address.
+// COMPAT mapping is not quite one-to-one.
 static inline uptr AlternativeAddress(uptr addr) {
 #if defined(TSAN_COMPAT_SHADOW) && TSAN_COMPAT_SHADOW
-  return addr | kLinuxAppMemMsk;
+  return addr | 0x280000000000ULL;
 #else
   return 0;
 #endif
diff --git a/lib/tsan/rtl/tsan_rtl.h b/lib/tsan/rtl/tsan_rtl.h
index f299a10..b7d0c13 100644
--- a/lib/tsan/rtl/tsan_rtl.h
+++ b/lib/tsan/rtl/tsan_rtl.h
@@ -47,7 +47,7 @@
 
 #ifndef TSAN_GO
 #if defined(TSAN_COMPAT_SHADOW) && TSAN_COMPAT_SHADOW
-const uptr kAllocatorSpace = 0x7e0000000000ULL;
+const uptr kAllocatorSpace = 0x7d0000000000ULL;
 #else
 const uptr kAllocatorSpace = 0x7d0000000000ULL;
 #endif