diff options
author | Ryan Govostes <rzg@apple.com> | 2016-05-05 01:27:04 +0000 |
---|---|---|
committer | Ryan Govostes <rzg@apple.com> | 2016-05-05 01:27:04 +0000 |
commit | 8c21be6b3e55d172212a69264deb43dea7c706c3 (patch) | |
tree | 8cf9aa91e91413c6b09196a012317954300d37eb | |
parent | b86dc66e753df9005aec9bbb39a4c00fa233015c (diff) | |
download | bcm5719-llvm-8c21be6b3e55d172212a69264deb43dea7c706c3.tar.gz bcm5719-llvm-8c21be6b3e55d172212a69264deb43dea7c706c3.zip |
Revert "[asan] add option to set shadow mapping offset"
This reverts commit ba89768f97b1d4326acb5e33c14eb23a05c7bea7.
llvm-svn: 268588
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 11 | ||||
-rw-r--r-- | llvm/test/Instrumentation/AddressSanitizer/scale-offset.ll | 39 |
2 files changed, 2 insertions, 48 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 7648352d0b9..f2b5179b436 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -204,13 +204,10 @@ static cl::opt<bool> ClSkipPromotableAllocas( // These flags allow to change the shadow mapping. // The shadow mapping looks like -// Shadow = (Mem >> scale) + offset +// Shadow = (Mem >> scale) + (1 << offset_log) static cl::opt<int> ClMappingScale("asan-mapping-scale", cl::desc("scale of asan shadow mapping"), cl::Hidden, cl::init(0)); -static cl::opt<uint64_t> ClMappingOffset("asan-mapping-offset", - cl::desc("offset of asan shadow mapping [EXPERIMENTAL]"), - cl::Hidden, cl::init(0)); // Optimization flags. Not user visible, used mostly for testing // and benchmarking the tool. @@ -407,14 +404,10 @@ static ShadowMapping getShadowMapping(Triple &TargetTriple, int LongSize, } Mapping.Scale = kDefaultShadowScale; - if (ClMappingScale.getNumOccurrences() > 0) { + if (ClMappingScale) { Mapping.Scale = ClMappingScale; } - if (ClMappingOffset.getNumOccurrences() > 0) { - Mapping.Offset = ClMappingOffset; - } - // OR-ing shadow offset if more efficient (at least on x86) if the offset // is a power of two, but on ppc64 we have to use add since the shadow // offset is not necessary 1/8-th of the address space. On SystemZ, diff --git a/llvm/test/Instrumentation/AddressSanitizer/scale-offset.ll b/llvm/test/Instrumentation/AddressSanitizer/scale-offset.ll deleted file mode 100644 index 8345586fec4..00000000000 --- a/llvm/test/Instrumentation/AddressSanitizer/scale-offset.ll +++ /dev/null @@ -1,39 +0,0 @@ -; Test that the scale (-asan-mapping-scale) and offset (-asan-mapping-offset) command-line options work as expected -; -; RUN: opt < %s -asan -asan-module -asan-mapping-offset 0xdeadbeef -S | FileCheck --check-prefix=CHECK-OFFSET %s -; RUN: opt < %s -asan -asan-module -asan-mapping-scale 1 -S | FileCheck --check-prefix=CHECK-SCALE %s -; RUN: opt < %s -asan -asan-module -asan-mapping-offset 0xc0ffee -asan-mapping-scale 0 -S | FileCheck --check-prefix=CHECK-BOTH %s -target triple = "x86_64-unknown-linux-gnu" - -define i32 @read_offset(i32* %a) sanitize_address { -entry: - %tmp1 = load i32, i32* %a, align 4 - ret i32 %tmp1 -} -; CHECK-OFFSET-LABEL: @read_offset -; CHECK-OFFSET-NOT: ret -; CHECK-OFFSET: lshr {{.*}} 3 -; CHECK-OFFSET-NEXT: add{{.*}}3735928559 -; CHECK-OFFSET: ret - -define i32 @read_scale(i32* %a) sanitize_address { -entry: - %tmp1 = load i32, i32* %a, align 4 - ret i32 %tmp1 -} -; CHECK-SCALE-LABEL: @read_scale -; CHECK-SCALE-NOT: ret -; CHECK-SCALE: lshr {{.*}} 1 -; CHECK-SCALE-NEXT: add{{.*}} -; CHECK-SCALE: ret - -define i32 @read_both(i32* %a) sanitize_address { -entry: - %tmp1 = load i32, i32* %a, align 4 - ret i32 %tmp1 -} -; CHECK-BOTH-LABEL: @read_both -; CHECK-BOTH-NOT: ret -; CHECK-BOTH: lshr {{.*}} 0 -; CHECK-BOTH-NEXT: add{{.*}}12648430 -; CHECK-BOTH: ret |