[llvm] 3552177 - [NFC][msan] Reorder branches in complex if
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 14 13:22:51 PST 2022
Author: Vitaly Buka
Date: 2022-01-14T13:22:43-08:00
New Revision: 3552177229609898d179cbd78bab434a54ea69ee
URL: https://github.com/llvm/llvm-project/commit/3552177229609898d179cbd78bab434a54ea69ee
DIFF: https://github.com/llvm/llvm-project/commit/3552177229609898d179cbd78bab434a54ea69ee.diff
LOG: [NFC][msan] Reorder branches in complex if
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D117274
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 5fa4e352dee2a..7a3fd790c8eca 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -1706,21 +1706,13 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
continue;
}
- bool FArgByVal = FArg.hasByValAttr();
- unsigned Size = FArgByVal
+ unsigned Size = FArg.hasByValAttr()
? 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) {
+ if (FArg.hasByValAttr()) {
// ByVal pointer itself has clean shadow. We copy the actual
// argument shadow to the underlying memory.
// Figure out maximal valid memcpy alignment.
@@ -1745,6 +1737,10 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
(void)Cpy;
}
*ShadowPtr = getCleanShadow(V);
+ } else if (MS.EagerChecks && FArg.hasAttribute(Attribute::NoUndef)) {
+ *ShadowPtr = getCleanShadow(V);
+ setOrigin(A, getCleanOrigin());
+ break;
} else {
if (Overflow) {
// ParamTLS overflow.
More information about the llvm-commits
mailing list