[llvm] f2fa9ac - [nfc][MSan] Change for-loop to ArgNo instead of drop_begin (#117553)

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 14:32:57 PST 2024


Author: k-kashapov
Date: 2024-12-03T14:32:54-08:00
New Revision: f2fa9ac6169758268bc16c46ec80da2e88ad7f2c

URL: https://github.com/llvm/llvm-project/commit/f2fa9ac6169758268bc16c46ec80da2e88ad7f2c
DIFF: https://github.com/llvm/llvm-project/commit/f2fa9ac6169758268bc16c46ec80da2e88ad7f2c.diff

LOG: [nfc][MSan] Change for-loop to ArgNo instead of drop_begin (#117553)

As discussed in
https://github.com/llvm/llvm-project/pull/109284#discussion_r1838830571
Changed for loop to use `ArgNo` instead of `drop_begin` to keep loop
code consistent with other helpers.

Co-authored-by: Kamil Kashapov <kashapov at ispras.ru>

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 dca6bf1adfde8a..934500509873fe 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -6159,8 +6159,10 @@ struct VarArgGenericHelper : public VarArgHelperBase {
     unsigned VAArgOffset = 0;
     const DataLayout &DL = F.getDataLayout();
     unsigned IntptrSize = DL.getTypeStoreSize(MS.IntptrTy);
-    for (Value *A :
-         llvm::drop_begin(CB.args(), CB.getFunctionType()->getNumParams())) {
+    for (const auto &[ArgNo, A] : llvm::enumerate(CB.args())) {
+      bool IsFixed = ArgNo < CB.getFunctionType()->getNumParams();
+      if (IsFixed)
+        continue;
       uint64_t ArgSize = DL.getTypeAllocSize(A->getType());
       if (DL.isBigEndian()) {
         // Adjusting the shadow for argument with size < IntptrSize to match the


        


More information about the llvm-commits mailing list