From 71a4fde39721c2fcef72a4be9bc1b3efe3383c77 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Thu, 13 Jan 2022 18:56:13 -0800 Subject: [PATCH] [NFC][msan] Init few vars later --- .../Instrumentation/MemorySanitizer.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp index 589eecf0a2fe6..5fa4e352dee2a 100644 --- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -3702,15 +3702,6 @@ struct MemorySanitizerVisitor : public InstVisitor { continue; } unsigned Size = 0; - Value *Store = nullptr; - // Compute the Shadow for arg even if it is ByVal, because - // in that case getShadow() will copy the actual arg shadow to - // __msan_param_tls. - Value *ArgShadow = getShadow(A); - Value *ArgShadowBase = getShadowPtrForArgument(A, IRB, ArgOffset); - LLVM_DEBUG(dbgs() << " Arg#" << i << ": " << *A - << " Shadow: " << *ArgShadow << "\n"); - bool ArgIsInitialized = false; const DataLayout &DL = F.getParent()->getDataLayout(); bool ByVal = CB.paramHasAttr(i, Attribute::ByVal); @@ -3721,6 +3712,15 @@ struct MemorySanitizerVisitor : public InstVisitor { insertShadowCheck(A, &CB); Size = DL.getTypeAllocSize(A->getType()); } else { + bool ArgIsInitialized = false; + Value *Store = nullptr; + // Compute the Shadow for arg even if it is ByVal, because + // in that case getShadow() will copy the actual arg shadow to + // __msan_param_tls. + Value *ArgShadow = getShadow(A); + Value *ArgShadowBase = getShadowPtrForArgument(A, IRB, ArgOffset); + LLVM_DEBUG(dbgs() << " Arg#" << i << ": " << *A + << " Shadow: " << *ArgShadow << "\n"); if (ByVal) { // ByVal requires some special handling as it's too big for a single // load