================
@@ -2348,6 +2349,33 @@ static bool isPotentiallyPromotable(const Instruction 
*I, const Loop *L) {
   return false;
 }
 
+/// Returns whether \p N has any operand from the set \p Operands.
+static bool
+hasAnyOperandsFrom(const MDNode *N,
+                   const SmallPtrSetImpl<const MDNode *> &Operands) {
+  return N && llvm::any_of(N->operands(), [&](const MDOperand &Op) {
+           return Operands.contains(cast<MDNode>(Op.get()));
+         });
+}
+
+/// Returns the alias scopes declared via llvm.experimental.noalias.scope.decl
+/// to be local to the loop \p L.
+static SmallPtrSet<const MDNode *, 4>
+collectLoopLocalAliasScopes(const Loop *L) {
----------------
nikic wrote:

It looks like LICM already has some code scanning over all instructions upfront 
here: 
https://github.com/llvm/llvm-project/blob/fd1b8bb163169eb542be827926dc7023e4037e7b/llvm/lib/Transforms/Scalar/LICM.cpp#L448-L452
 Maybe it makes sense to collect the scopes there as well, to avoid a separate 
scan over all instructions?

https://github.com/llvm/llvm-project/pull/223530
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to