[llvm] [Attributor] Remove dead function getKnownConstantRange (PR #221897)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 00:26:12 PDT 2026


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

getKnownConstantRange was added on January 15, 2020 in commit
188f9a348dc545bf9a420d998ad37761bddd7285 without any callers and has
been unused since.


>From 6faf99940dc0c40a9d511531d54f55a60af42ee7 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 13 Aug 2026 11:15:31 -0700
Subject: [PATCH] [Attributor] Remove dead function getKnownConstantRange

getKnownConstantRange was added on January 15, 2020 in commit
188f9a348dc545bf9a420d998ad37761bddd7285 without any callers and has
been unused since.
---
 llvm/include/llvm/Transforms/IPO/Attributor.h    |  6 ------
 llvm/lib/Transforms/IPO/AttributorAttributes.cpp | 13 -------------
 2 files changed, 19 deletions(-)

diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index 6e4d3d92d8106..00b20eee4d5df 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -4941,12 +4941,6 @@ struct AAValueConstantRange
   getAssumedConstantRange(Attributor &A,
                           const Instruction *CtxI = nullptr) const = 0;
 
-  /// Return a known range for the associated value at a program point \p CtxI.
-  /// If \p I is nullptr, simply return a known range.
-  virtual ConstantRange
-  getKnownConstantRange(Attributor &A,
-                        const Instruction *CtxI = nullptr) const = 0;
-
   /// Return an assumed constant for the associated value a program point \p
   /// CtxI.
   std::optional<Constant *>
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 8d16f49525ca8..223ddc5c217b5 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -9247,19 +9247,6 @@ struct AAValueConstantRangeImpl : AAValueConstantRange {
     return true;
   }
 
-  /// See AAValueConstantRange::getKnownConstantRange(..).
-  ConstantRange
-  getKnownConstantRange(Attributor &A,
-                        const Instruction *CtxI = nullptr) const override {
-    if (!isValidCtxInstructionForOutsideAnalysis(A, CtxI,
-                                                 /* AllowAACtxI */ false))
-      return getKnown();
-
-    ConstantRange LVIR = getConstantRangeFromLVI(A, CtxI);
-    ConstantRange SCEVR = getConstantRangeFromSCEV(A, CtxI);
-    return getKnown().intersectWith(SCEVR).intersectWith(LVIR);
-  }
-
   /// See AAValueConstantRange::getAssumedConstantRange(..).
   ConstantRange
   getAssumedConstantRange(Attributor &A,



More information about the llvm-commits mailing list