[PATCH] D132765: [msan] Enabled msan-check-constant-shadow by default
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 26 15:26:19 PDT 2022
vitalybuka updated this revision to Diff 456037.
vitalybuka added a comment.
rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132765/new/
https://reviews.llvm.org/D132765
Files:
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
llvm/test/Instrumentation/MemorySanitizer/check-constant-shadow.ll
Index: llvm/test/Instrumentation/MemorySanitizer/check-constant-shadow.ll
===================================================================
--- llvm/test/Instrumentation/MemorySanitizer/check-constant-shadow.ll
+++ llvm/test/Instrumentation/MemorySanitizer/check-constant-shadow.ll
@@ -1,5 +1,5 @@
-; RUN: opt < %s -msan-check-access-address=0 -msan-check-constant-shadow=1 -msan-eager-checks=1 -msan-track-origins=1 -S -passes=msan 2>&1 | FileCheck --check-prefixes=CHECK,CONST %s --implicit-check-not=icmp --implicit-check-not="store i" --implicit-check-not="call void @__msan"
-; RUN: opt < %s -msan-check-access-address=0 -msan-eager-checks=1 -msan-track-origins=1 -S -passes=msan 2>&1 | FileCheck --check-prefixes=CHECK %s --implicit-check-not=icmp --implicit-check-not="store i" --implicit-check-not="call void @__msan"
+; RUN: opt < %s -msan-check-access-address=0 -msan-eager-checks=1 -msan-track-origins=1 -S -passes=msan 2>&1 | FileCheck --check-prefixes=CHECK,CONST %s --implicit-check-not=icmp --implicit-check-not="store i" --implicit-check-not="call void @__msan"
+; RUN: opt < %s -msan-check-access-address=0 -msan-check-constant-shadow=0 -msan-eager-checks=1 -msan-track-origins=1 -S -passes=msan 2>&1 | FileCheck --check-prefixes=CHECK %s --implicit-check-not=icmp --implicit-check-not="store i" --implicit-check-not="call void @__msan"
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@@ -73,5 +73,5 @@
}
; CHECK-LABEL: @MaybeUninitializedRetNoUndef
-; CHECK: br i1 icmp ne (i32 extractelement (<4 x i32> bitcast (<2 x i64> <i64 0, i64 undef> to <4 x i32>), i64 0), i32 0)
-; CHECK: call void @__msan_warning_with_origin_noreturn
+; CONST: br i1 icmp ne (i32 extractelement (<4 x i32> bitcast (<2 x i64> <i64 0, i64 undef> to <4 x i32>), i64 0), i32 0)
+; CONST: call void @__msan_warning_with_origin_noreturn
Index: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -321,13 +321,10 @@
cl::desc("Apply no_sanitize to the whole file"), cl::Hidden,
cl::init(false));
-// This is an experiment to enable handling of cases where shadow is a non-zero
-// compile-time constant. For some unexplainable reason they were silently
-// ignored in the instrumentation.
static cl::opt<bool>
ClCheckConstantShadow("msan-check-constant-shadow",
cl::desc("Insert checks for constant shadow values"),
- cl::Hidden, cl::init(false));
+ cl::Hidden, cl::init(true));
// This is off by default because of a bug in gold:
// https://sourceware.org/bugzilla/show_bug.cgi?id=19002
@@ -1779,9 +1776,7 @@
Value *getOrigin(Value *V) {
if (!MS.TrackOrigins)
return nullptr;
- if (!PropagateShadow)
- return getCleanOrigin();
- if (isa<Constant>(V))
+ if (!PropagateShadow || isa<Constant>(V) || isa<InlineAsm>(V))
return getCleanOrigin();
assert((isa<Instruction>(V) || isa<Argument>(V)) &&
"Unexpected value type in getOrigin()");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132765.456037.patch
Type: text/x-patch
Size: 3447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220826/2b2c9693/attachment.bin>
More information about the llvm-commits
mailing list