[llvm] [InstCombine] Use llvm::set_is_subset (NFC) (PR #102778)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 10 17:20:31 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/102778

None

>From b2c4cb22f20e79fa4f079272518c112409eca1fc Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 10 Aug 2024 17:15:07 -0700
Subject: [PATCH] [InstCombine] Use llvm::set_is_subset (NFC)

---
 .../Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp   | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
index 1661fa564c65c7..0b51845ab5e257 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -12,6 +12,7 @@
 
 #include "InstCombineInternal.h"
 #include "llvm/ADT/MapVector.h"
+#include "llvm/ADT/SetOperations.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Analysis/AliasAnalysis.h"
@@ -287,10 +288,7 @@ bool PointerReplacer::collectUsers() {
   // Ensure that all outstanding (indirect) users of I
   // are inserted into the Worklist. Return false
   // otherwise.
-  for (auto *Inst : ValuesToRevisit)
-    if (!Worklist.contains(Inst))
-      return false;
-  return true;
+  return llvm::set_is_subset(ValuesToRevisit, Worklist);
 }
 
 bool PointerReplacer::collectUsersRecursive(Instruction &I) {



More information about the llvm-commits mailing list