[PATCH] D44926: Add msan custom mapping options
Evgenii Stepanov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 27 14:30:59 PDT 2018
eugenis added inline comments.
================
Comment at: lib/Transforms/Instrumentation/MemorySanitizer.cpp:610
+ if (ShadowPassed || OriginPassed) {
+ if (ClAndMask.getNumOccurrences() > 0)
+ Custom_MemoryMapParams.AndMask = ClAndMask;
----------------
This getNumOccurrences() check and the 3 checks below are unnecessary.
================
Comment at: lib/Transforms/Instrumentation/MemorySanitizer.cpp:618
+ Custom_MemoryMapParams.OriginBase = ClOriginBase;
+ MapParams = &Custom_MemoryMapParams;
+ } else {
----------------
I feel uneasy about modifying global Custom_MemoryMapParams in module-specific initialization. Sure, it will be the same for each module, and it is determined by global cl:opt values anyway, but lets move it inside class MemorySanitizer to be on the safe side.
================
Comment at: test/Instrumentation/MemorySanitizer/manual-shadow.ll:4
+; RUN: opt < %s -msan -msan -msan-shadow-base 0xdeadbeef -S | FileCheck --check-prefix=CHECK-BASE %s
+; RUN: opt < %s -msan -msan -msan-shadow-base 0xdeadbeef -msan -msan-and-mask 0xffff0000 -S | FileCheck --check-prefix=CHECK-AND %s
+; RUN: opt < %s -msan -msan -msan-shadow-base 0xdeadbeef -msan -msan-xor-mask 0x0000beef -S | FileCheck --check-prefix=CHECK-XOR %s
----------------
that's a lot of -msan flags
================
Comment at: test/Instrumentation/MemorySanitizer/manual-shadow.ll:6
+; RUN: opt < %s -msan -msan -msan-shadow-base 0xdeadbeef -msan -msan-xor-mask 0x0000beef -S | FileCheck --check-prefix=CHECK-XOR %s
+; RUN: opt < %s -msan -msan -msan-shadow-base 0xdeadbeef -msan -msan-xor-mask 0x0000beef -msan-and-mask 0xffff0000 -S | FileCheck --check-prefix=CHECK-XOR-AND %s
+
----------------
Could you make the numbers decimal so they can be easily recognized in the IR?
================
Comment at: test/Instrumentation/MemorySanitizer/manual-shadow.ll:7
+; RUN: opt < %s -msan -msan -msan-shadow-base 0xdeadbeef -msan -msan-xor-mask 0x0000beef -msan-and-mask 0xffff0000 -S | FileCheck --check-prefix=CHECK-XOR-AND %s
+
+
----------------
Please add a test for origin-base.
Repository:
rL LLVM
https://reviews.llvm.org/D44926
More information about the llvm-commits
mailing list