[llvm-branch-commits] [llvm] [LICM] Drop per-iteration AA tags (PR #223530)

Nikita Popov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Sep 15 03:46:53 PDT 2026


================
@@ -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


More information about the llvm-branch-commits mailing list