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

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 05:21:58 PST 2024


https://github.com/k-kashapov created https://github.com/llvm/llvm-project/pull/117553

Changed for loop to use `ArgNo` instead of `drop_begin` to keep loop code consistent with other helpers.

>From a520283010bfeed3a55f1f8c5721f0e0c4cef660 Mon Sep 17 00:00:00 2001
From: Kamil Kashapov <kashapov at ispras.ru>
Date: Mon, 25 Nov 2024 16:17:24 +0300
Subject: [PATCH] [nfc][MSan] Change for-loop to ArgNo instead of drop_begin

---
 llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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