[llvm] r174957 - [asan] change the default mapping offset on x86_64 to 0x7fff8000. This gives roughly 5% speedup. Since this is an ABI change, bump the asan ABI version by renaming __asan_init to __asan_init_v1. llvm part, compiler-rt part will follow
Kostya Serebryany
kcc at google.com
Tue Feb 12 03:11:02 PST 2013
Author: kcc
Date: Tue Feb 12 05:11:02 2013
New Revision: 174957
URL: http://llvm.org/viewvc/llvm-project?rev=174957&view=rev
Log:
[asan] change the default mapping offset on x86_64 to 0x7fff8000. This gives roughly 5% speedup. Since this is an ABI change, bump the asan ABI version by renaming __asan_init to __asan_init_v1. llvm part, compiler-rt part will follow
Modified:
llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=174957&r1=174956&r2=174957&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Tue Feb 12 05:11:02 2013
@@ -68,7 +68,7 @@ static const char *kAsanRegisterGlobalsN
static const char *kAsanUnregisterGlobalsName = "__asan_unregister_globals";
static const char *kAsanPoisonGlobalsName = "__asan_before_dynamic_init";
static const char *kAsanUnpoisonGlobalsName = "__asan_after_dynamic_init";
-static const char *kAsanInitName = "__asan_init";
+static const char *kAsanInitName = "__asan_init_v1";
static const char *kAsanHandleNoReturnName = "__asan_handle_no_return";
static const char *kAsanMappingOffsetName = "__asan_mapping_offset";
static const char *kAsanMappingScaleName = "__asan_mapping_scale";
@@ -136,7 +136,7 @@ static cl::opt<int> ClMappingOffsetLog("
cl::desc("offset of asan shadow mapping"), cl::Hidden, cl::init(-1));
static cl::opt<bool> ClShort64BitOffset("asan-short-64bit-mapping-offset",
cl::desc("Use short immediate constant as the mapping offset for 64bit"),
- cl::Hidden, cl::init(false));
+ cl::Hidden, cl::init(true));
// Optimization flags. Not user visible, used mostly for testing
// and benchmarking the tool.
@@ -203,6 +203,7 @@ static ShadowMapping getShadowMapping(co
llvm::Triple TargetTriple(M.getTargetTriple());
bool IsAndroid = TargetTriple.getEnvironment() == llvm::Triple::Android;
bool IsPPC64 = TargetTriple.getArch() == llvm::Triple::ppc64;
+ bool IsX86_64 = TargetTriple.getArch() == llvm::Triple::x86_64;
ShadowMapping Mapping;
@@ -214,7 +215,8 @@ static ShadowMapping getShadowMapping(co
Mapping.Offset = (IsAndroid || ZeroBaseShadow) ? 0 :
(LongSize == 32 ? kDefaultShadowOffset32 :
IsPPC64 ? kPPC64_ShadowOffset64 : kDefaultShadowOffset64);
- if (!ZeroBaseShadow && ClShort64BitOffset && LongSize == 64) {
+ if (!ZeroBaseShadow && ClShort64BitOffset && IsX86_64) {
+ assert(LongSize == 64);
Mapping.Offset = kDefaultShort64bitShadowOffset;
} if (!ZeroBaseShadow && ClMappingOffsetLog >= 0) {
// Zero offset log is the special case.
More information about the llvm-commits
mailing list