[llvm] [InstCombine] Create a class to lazily track computed known bits (PR #66611)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 16 00:14:51 PDT 2023


github-actions[bot] wrote:


<!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 7571f27ed768530f3fe9707d310c83d5a687ea16 3704c17e177e65d960fc8402c026d2beb1e50cba -- llvm/include/llvm/Analysis/CachedBitsValue.h llvm/include/llvm/Analysis/WithCache.h llvm/include/llvm/Analysis/ValueTracking.h llvm/include/llvm/Transforms/InstCombine/InstCombiner.h llvm/lib/Analysis/ValueTracking.cpp llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp llvm/lib/Transforms/InstCombine/InstCombineInternal.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/Analysis/CachedBitsValue.h b/llvm/include/llvm/Analysis/CachedBitsValue.h
index 34f0675e9816..1685e2edbb17 100644
--- a/llvm/include/llvm/Analysis/CachedBitsValue.h
+++ b/llvm/include/llvm/Analysis/CachedBitsValue.h
@@ -19,9 +19,8 @@
 #include "llvm/Support/KnownBits.h"
 #include <type_traits>
 
-
 namespace llvm {
-  struct SimplifyQuery;
+struct SimplifyQuery;
 }
 
 llvm::KnownBits computeKnownBits(const llvm::Value *V, unsigned Depth,
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index d4f6bc541a29..b1d5d6a4e4c1 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -180,10 +180,10 @@ void llvm::computeKnownBits(const Value *V, const APInt &DemandedElts,
 }
 
 KnownBits computeKnownBits(const Value *V, const APInt &DemandedElts,
-                                  unsigned Depth, const SimplifyQuery &Q);
+                           unsigned Depth, const SimplifyQuery &Q);
 
 KnownBits computeKnownBits(const Value *V, unsigned Depth,
-                                  const SimplifyQuery &Q);
+                           const SimplifyQuery &Q);
 
 KnownBits llvm::computeKnownBits(const Value *V, const DataLayout &DL,
                                  unsigned Depth, AssumptionCache *AC,
@@ -256,9 +256,8 @@ bool llvm::haveNoCommonBitsSet(const WithCache<const Value *> &LHSCache,
       return true;
   }
 
-  return KnownBits::haveNoCommonBitsSet(
-      LHSCache.getKnownBits(SQ),
-      RHSCache.getKnownBits(SQ));
+  return KnownBits::haveNoCommonBitsSet(LHSCache.getKnownBits(SQ),
+                                        RHSCache.getKnownBits(SQ));
 }
 
 bool llvm::isOnlyUsedInZeroEqualityComparison(const Instruction *I) {
@@ -1788,7 +1787,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
 /// Determine which bits of V are known to be either zero or one and return
 /// them.
 KnownBits computeKnownBits(const Value *V, const APInt &DemandedElts,
-                                 unsigned Depth, const SimplifyQuery &Q) {
+                           unsigned Depth, const SimplifyQuery &Q) {
   KnownBits Known(getBitWidth(V->getType(), Q.DL));
   computeKnownBits(V, DemandedElts, Known, Depth, Q);
   return Known;
@@ -1797,7 +1796,7 @@ KnownBits computeKnownBits(const Value *V, const APInt &DemandedElts,
 /// Determine which bits of V are known to be either zero or one and return
 /// them.
 KnownBits computeKnownBits(const Value *V, unsigned Depth,
-                                 const SimplifyQuery &Q) {
+                           const SimplifyQuery &Q) {
   KnownBits Known(getBitWidth(V->getType(), Q.DL));
   computeKnownBits(V, Known, Depth, Q);
   return Known;

``````````

</details>


https://github.com/llvm/llvm-project/pull/66611


More information about the llvm-commits mailing list