[llvm] da4957b - [NFC] [hwasan] use for_each and move comment

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 17:42:17 PST 2024


Author: Florian Mayer
Date: 2024-03-07T17:42:01-08:00
New Revision: da4957be2365831c94eab0b52612367c29f1d299

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

LOG: [NFC] [hwasan] use for_each and move comment

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp b/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
index 2ffe89a2458405..bfe474d8204578 100644
--- a/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
+++ b/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
@@ -12,6 +12,7 @@
 
 #include "llvm/Transforms/Utils/MemoryTaggingSupport.h"
 
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/Analysis/CFG.h"
 #include "llvm/Analysis/PostDominators.h"
 #include "llvm/Analysis/StackSafetyAnalysis.h"
@@ -69,14 +70,12 @@ bool forAllReachableExits(const DominatorTree &DT, const PostDominatorTree &PDT,
       ++NumCoveredExits;
     }
   }
-  // If there's a mix of covered and non-covered exits, just put the untag
-  // on exits, so we avoid the redundancy of untagging twice.
   if (NumCoveredExits == ReachableRetVec.size()) {
-    for (auto *End : Ends)
-      Callback(End);
+    for_each(Ends, Callback);
   } else {
-    for (auto *RI : ReachableRetVec)
-      Callback(RI);
+    // If there's a mix of covered and non-covered exits, just put the untag
+    // on exits, so we avoid the redundancy of untagging twice.
+    for_each(ReachableRetVec, Callback);
     // We may have inserted untag outside of the lifetime interval.
     // Signal the caller to remove the lifetime end call for this alloca.
     return false;


        


More information about the llvm-commits mailing list