[llvm] 42b6c8e - [ValueTracking] Convert isKnownNegative() to use SimplifyQuery (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 02:13:49 PST 2023


Author: Nikita Popov
Date: 2023-11-29T11:11:12+01:00
New Revision: 42b6c8ed3ae44ed61af5ba81bdaa5b81a9ce61ad

URL: https://github.com/llvm/llvm-project/commit/42b6c8ed3ae44ed61af5ba81bdaa5b81a9ce61ad
DIFF: https://github.com/llvm/llvm-project/commit/42b6c8ed3ae44ed61af5ba81bdaa5b81a9ce61ad.diff

LOG: [ValueTracking] Convert isKnownNegative() to use SimplifyQuery (NFC)

It looks like this function is actually unused.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/ValueTracking.h
    llvm/lib/Analysis/ValueTracking.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/ValueTracking.h b/llvm/include/llvm/Analysis/ValueTracking.h
index cd90ad470342cc9..f54067916659668 100644
--- a/llvm/include/llvm/Analysis/ValueTracking.h
+++ b/llvm/include/llvm/Analysis/ValueTracking.h
@@ -148,11 +148,8 @@ bool isKnownPositive(const Value *V, const SimplifyQuery &SQ,
 
 /// Returns true if the given value is known be negative (i.e. non-positive
 /// and non-zero).
-bool isKnownNegative(const Value *V, const DataLayout &DL, unsigned Depth = 0,
-                     AssumptionCache *AC = nullptr,
-                     const Instruction *CxtI = nullptr,
-                     const DominatorTree *DT = nullptr,
-                     bool UseInstrInfo = true);
+bool isKnownNegative(const Value *V, const SimplifyQuery &DL,
+                     unsigned Depth = 0);
 
 /// Return true if the given values are known to be non-equal when defined.
 /// Supports scalar integer types only.

diff  --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index e626dacb28d0bc5..01e542829258442 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -291,11 +291,9 @@ bool llvm::isKnownPositive(const Value *V, const SimplifyQuery &SQ,
   return isKnownNonNegative(V, SQ, Depth) && ::isKnownNonZero(V, Depth, SQ);
 }
 
-bool llvm::isKnownNegative(const Value *V, const DataLayout &DL, unsigned Depth,
-                           AssumptionCache *AC, const Instruction *CxtI,
-                           const DominatorTree *DT, bool UseInstrInfo) {
-  KnownBits Known = computeKnownBits(V, DL, Depth, AC, CxtI, DT, UseInstrInfo);
-  return Known.isNegative();
+bool llvm::isKnownNegative(const Value *V, const SimplifyQuery &SQ,
+                           unsigned Depth) {
+  return computeKnownBits(V, Depth, SQ).isNegative();
 }
 
 static bool isKnownNonEqual(const Value *V1, const Value *V2, unsigned Depth,


        


More information about the llvm-commits mailing list