[llvm] [Analysis] Remove unused functions (NFC) (PR #228674)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 3 00:38:12 PDT 2026


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

This patch removes unused functions whose last callers have been
removed:

- AAResults::callCapturesBefore (3-argument overload): The last caller
  was removed on September 1, 2026 in commit
  07ed92d6987f639b2c29c37a08d99313c69293cd.

- ScalarEvolution::hasOperand: The last caller was removed on
  November 19, 2021 in commit
  f492a414bad782ae4202d2af9d3408f8e727599d.

- TBAANodeImpl::isTypeImmutable: The last callers were removed on
  June 1, 2026 in commit c9b2d7224c006239641214b2b58b0ab67a254308.

Assisted-by: Antigravity


>From b647b98be9c6f88e614860ed26ea6c241428a1f4 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 2 Oct 2026 10:46:28 -0700
Subject: [PATCH] [Analysis] Remove unused functions (NFC)

This patch removes unused functions whose last callers have been
removed:

- AAResults::callCapturesBefore (3-argument overload): The last caller
  was removed on September 1, 2026 in commit
  07ed92d6987f639b2c29c37a08d99313c69293cd.

- ScalarEvolution::hasOperand: The last caller was removed on
  November 19, 2021 in commit
  f492a414bad782ae4202d2af9d3408f8e727599d.

- TBAANodeImpl::isTypeImmutable: The last callers were removed on
  June 1, 2026 in commit c9b2d7224c006239641214b2b58b0ab67a254308.

Assisted-by: Antigravity
---
 llvm/include/llvm/Analysis/AliasAnalysis.h   | 10 ----------
 llvm/include/llvm/Analysis/ScalarEvolution.h |  3 ---
 llvm/lib/Analysis/ScalarEvolution.cpp        |  4 ----
 llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp | 12 ------------
 4 files changed, 29 deletions(-)

diff --git a/llvm/include/llvm/Analysis/AliasAnalysis.h b/llvm/include/llvm/Analysis/AliasAnalysis.h
index 9266f3c3a63a0b..281ddc9128160c 100644
--- a/llvm/include/llvm/Analysis/AliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/AliasAnalysis.h
@@ -500,16 +500,6 @@ class AAResults {
   LLVM_ABI ModRefInfo getModRefInfo(const Instruction *I1,
                                     const Instruction *I2);
 
-  /// Return information about whether a particular call site modifies
-  /// or reads the specified memory location \p MemLoc before instruction \p I
-  /// in a BasicBlock.
-  ModRefInfo callCapturesBefore(const Instruction *I,
-                                const MemoryLocation &MemLoc,
-                                DominatorTree *DT) {
-    SimpleAAQueryInfo AAQIP(*this);
-    return callCapturesBefore(I, MemLoc, DT, AAQIP);
-  }
-
   /// @}
   //===--------------------------------------------------------------------===//
   /// \name Higher level methods for querying mod/ref information.
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index 8e0af061d82ca8..79944d6870158a 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -1524,9 +1524,6 @@ class ScalarEvolution {
   /// the specified basic block.
   LLVM_ABI bool properlyDominates(const SCEV *S, const BasicBlock *BB);
 
-  /// Test whether the given SCEV has Op as a direct or indirect operand.
-  LLVM_ABI bool hasOperand(const SCEV *S, const SCEV *Op) const;
-
   /// Return the size of an element read or written by Inst.
   LLVM_ABI const SCEV *getElementSize(Instruction *Inst);
 
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 530b1400ae69ee..d78a4f103324c7 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -14602,10 +14602,6 @@ bool ScalarEvolution::properlyDominates(const SCEV *S, const BasicBlock *BB) {
   return getBlockDisposition(S, BB) == ProperlyDominatesBlock;
 }
 
-bool ScalarEvolution::hasOperand(const SCEV *S, const SCEV *Op) const {
-  return SCEVExprContains(S, [&](const SCEV *Expr) { return Expr == Op; });
-}
-
 void ScalarEvolution::forgetBackedgeTakenCounts(const Loop *L,
                                                 bool Predicated) {
   auto &BECounts =
diff --git a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
index fb2c5efa62dd33..c5f9890018e26e 100644
--- a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
@@ -169,18 +169,6 @@ class TBAANodeImpl {
     // Ok, this node has a valid parent. Return it.
     return TBAANodeImpl<MDNodeTy>(P);
   }
-
-  /// Test if this TBAANode represents a type for objects which are
-  /// not modified (by any means) in the context where this
-  /// AliasAnalysis is relevant.
-  bool isTypeImmutable() const {
-    if (Node->getNumOperands() < 3)
-      return false;
-    ConstantInt *CI = mdconst::dyn_extract<ConstantInt>(Node->getOperand(2));
-    if (!CI)
-      return false;
-    return CI->getValue()[0];
-  }
 };
 
 /// \name Specializations of \c TBAANodeImpl for const and non const qualified



More information about the llvm-commits mailing list