[PATCH] D117276: [NFC][msan] Don't setOrigin for byval pointer
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 14 16:42:46 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG18e4369e195d: [NFC][msan] Don't setOrigin for byval pointer (authored by vitalybuka).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117276/new/
https://reviews.llvm.org/D117276
Files:
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
llvm/test/Instrumentation/MemorySanitizer/byval.ll
Index: llvm/test/Instrumentation/MemorySanitizer/byval.ll
===================================================================
--- llvm/test/Instrumentation/MemorySanitizer/byval.ll
+++ llvm/test/Instrumentation/MemorySanitizer/byval.ll
@@ -11,7 +11,6 @@
; CHECK-LABEL: @ByValArgument(
; CHECK-NEXT: entry:
; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64({{.*}} @__msan_param_tls to i64), i64 8) to i8*), i64 16, i1 false)
-; CHECK: load i32, i32* inttoptr (i64 add (i64 ptrtoint ([200 x i32]* @__msan_param_origin_tls to i64), i64 8) to i32*)
; CHECK: %x = load i128, i128* %p
; CHECK: load i128
; CHECK: load i32
@@ -42,7 +41,6 @@
; CHECK-LABEL: @ByValForward(
; CHECK-NEXT: entry:
; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64({{.*}} @__msan_param_tls to i64), i64 8) to i8*), i64 16, i1 false)
-; CHECK: load i32, i32* inttoptr (i64 add (i64 ptrtoint ([200 x i32]* @__msan_param_origin_tls to i64), i64 8) to i32*)
; CHECK: store i64 0, i64* getelementptr inbounds ([100 x i64], [100 x i64]* @__msan_param_tls, i32 0, i32 0)
; CHECK-NEXT: call void @Fn(
; CHECK-NEXT: ret void
@@ -70,7 +68,6 @@
; CHECK-LABEL: @ByValForwardByVal(
; CHECK-NEXT: entry:
; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64({{.*}} @__msan_param_tls to i64), i64 8) to i8*), i64 16, i1 false)
-; CHECK: load i32, i32* inttoptr (i64 add (i64 ptrtoint ([200 x i32]* @__msan_param_origin_tls to i64), i64 8) to i32*)
; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* bitcast ([100 x i64]* @__msan_param_tls to i8*), i8* {{.*}}, i64 16, i1 false)
; CHECK: store i32 {{.*}}, i32* getelementptr inbounds ([200 x i32], [200 x i32]* @__msan_param_origin_tls, i32 0, i32 0)
; CHECK-NEXT: call void @FnByVal(
Index: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -1737,6 +1737,7 @@
(void)Cpy;
}
*ShadowPtr = getCleanShadow(V);
+ setOrigin(A, getCleanOrigin());
} else if (MS.EagerChecks && FArg.hasAttribute(Attribute::NoUndef)) {
*ShadowPtr = getCleanShadow(V);
setOrigin(A, getCleanOrigin());
@@ -1745,23 +1746,21 @@
if (Overflow) {
// ParamTLS overflow.
*ShadowPtr = getCleanShadow(V);
+ setOrigin(A, getCleanOrigin());
} else {
// Shadow over TLS
Value *Base = getShadowPtrForArgument(&FArg, EntryIRB, ArgOffset);
*ShadowPtr = EntryIRB.CreateAlignedLoad(getShadowTy(&FArg), Base,
kShadowTLSAlignment);
+ if (MS.TrackOrigins) {
+ Value *OriginPtr =
+ getOriginPtrForArgument(&FArg, EntryIRB, ArgOffset);
+ setOrigin(A, EntryIRB.CreateLoad(MS.OriginTy, OriginPtr));
+ }
}
}
LLVM_DEBUG(dbgs()
<< " ARG: " << FArg << " ==> " << **ShadowPtr << "\n");
- if (MS.TrackOrigins && !Overflow) {
- Value *OriginPtr =
- getOriginPtrForArgument(&FArg, EntryIRB, ArgOffset);
- setOrigin(A, EntryIRB.CreateLoad(MS.OriginTy, OriginPtr));
- } else {
- setOrigin(A, getCleanOrigin());
- }
-
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117276.400191.patch
Type: text/x-patch
Size: 3566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220115/2dedb60f/attachment.bin>
More information about the llvm-commits
mailing list