[llvm] 36138d8 - [NFC][msan] Declare some getShadow vars later
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 13 21:36:45 PST 2022
Author: Vitaly Buka
Date: 2022-01-13T21:36:37-08:00
New Revision: 36138d825251e07da01ef16dd68fcb61cf627e4f
URL: https://github.com/llvm/llvm-project/commit/36138d825251e07da01ef16dd68fcb61cf627e4f
DIFF: https://github.com/llvm/llvm-project/commit/36138d825251e07da01ef16dd68fcb61cf627e4f.diff
LOG: [NFC][msan] Declare some getShadow vars later
Added:
Modified:
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 524a14bda383..589eecf0a2fe 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -1707,21 +1707,20 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
}
bool FArgByVal = FArg.hasByValAttr();
- bool FArgNoUndef = FArg.hasAttribute(Attribute::NoUndef);
- bool FArgEagerCheck = MS.EagerChecks && !FArgByVal && FArgNoUndef;
- unsigned Size =
- FArg.hasByValAttr()
- ? DL.getTypeAllocSize(FArg.getParamByValType())
- : DL.getTypeAllocSize(FArg.getType());
+ unsigned Size = FArgByVal
+ ? DL.getTypeAllocSize(FArg.getParamByValType())
+ : DL.getTypeAllocSize(FArg.getType());
if (A == &FArg) {
bool Overflow = ArgOffset + Size > kParamTLSSize;
+ bool FArgEagerCheck = MS.EagerChecks && !FArgByVal &&
+ FArg.hasAttribute(Attribute::NoUndef);
+
if (FArgEagerCheck) {
*ShadowPtr = getCleanShadow(V);
setOrigin(A, getCleanOrigin());
break;
} else if (FArgByVal) {
- Value *Base = getShadowPtrForArgument(&FArg, EntryIRB, ArgOffset);
// ByVal pointer itself has clean shadow. We copy the actual
// argument shadow to the underlying memory.
// Figure out maximal valid memcpy alignment.
@@ -1738,6 +1737,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
CpShadowPtr, Constant::getNullValue(EntryIRB.getInt8Ty()),
Size, ArgAlign);
} else {
+ Value *Base = getShadowPtrForArgument(&FArg, EntryIRB, ArgOffset);
const Align CopyAlign = std::min(ArgAlign, kShadowTLSAlignment);
Value *Cpy = EntryIRB.CreateMemCpy(CpShadowPtr, CopyAlign, Base,
CopyAlign, Size);
@@ -1746,12 +1746,12 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
}
*ShadowPtr = getCleanShadow(V);
} else {
- // Shadow over TLS
- Value *Base = getShadowPtrForArgument(&FArg, EntryIRB, ArgOffset);
if (Overflow) {
// ParamTLS overflow.
*ShadowPtr = getCleanShadow(V);
} else {
+ // Shadow over TLS
+ Value *Base = getShadowPtrForArgument(&FArg, EntryIRB, ArgOffset);
*ShadowPtr = EntryIRB.CreateAlignedLoad(getShadowTy(&FArg), Base,
kShadowTLSAlignment);
}
More information about the llvm-commits
mailing list