[llvm] Range assume bundles (PR #112758)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 11:25:31 PDT 2024


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 f35a14dd507b6fc90fe8e0b606c2f787d7dfedea 3ef8137f37ffebeb9803fbc40a0c922404a45fd7 --extensions cpp,h -- llvm/include/llvm/Analysis/AssumeBundleQueries.h llvm/lib/Analysis/AssumeBundleQueries.cpp llvm/lib/Analysis/ValueTracking.cpp llvm/lib/IR/Verifier.cpp llvm/unittests/Analysis/AssumeBundleQueriesTest.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 826d44dad5..b9e0ec9928 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -596,17 +596,17 @@ static bool isKnownNonZeroFromAssume(const Value *V, const SimplifyQuery &Q) {
 
     if (Elem.Index != AssumptionCache::ExprResultIdx) {
       if (V->getType()->isPointerTy()) {
-      if (RetainedKnowledge RK = getKnowledgeFromBundle(
-              *I, I->bundle_op_info_begin()[Elem.Index])) {
-        if (RK.WasOn == V &&
-            (RK.AttrKind == Attribute::NonNull ||
-             (RK.AttrKind == Attribute::Dereferenceable &&
+        if (RetainedKnowledge RK = getKnowledgeFromBundle(
+                *I, I->bundle_op_info_begin()[Elem.Index])) {
+          if (RK.WasOn == V &&
+              (RK.AttrKind == Attribute::NonNull ||
+               (RK.AttrKind == Attribute::Dereferenceable &&
                 !NullPointerIsDefined(
                     Q.CxtI->getFunction(),
-                                    V->getType()->getPointerAddressSpace()))) &&
-            isValidAssumeForContext(I, Q.CxtI, Q.DT))
-          return true;
-      }
+                    V->getType()->getPointerAddressSpace()))) &&
+              isValidAssumeForContext(I, Q.CxtI, Q.DT))
+            return true;
+        }
       } else if (V->getType()->isIntOrIntVectorTy()) {
         if (std::optional<ConstantRange> Range =
                 getRangeFromBundle(*I, I->bundle_op_info_begin()[Elem.Index]))
@@ -834,12 +834,13 @@ void llvm::computeKnownBitsFromContext(const Value *V, KnownBits &Known,
       if (V->getType()->isPointerTy()) {
         if (RetainedKnowledge RK = getKnowledgeFromBundle(
                 *I, I->bundle_op_info_begin()[Elem.Index])) {
-        // Allow AllowEphemerals in isValidAssumeForContext, as the CxtI might
-        // be the producer of the pointer in the bundle. At the moment, align
-        // assumptions aren't optimized away.
+          // Allow AllowEphemerals in isValidAssumeForContext, as the CxtI might
+          // be the producer of the pointer in the bundle. At the moment, align
+          // assumptions aren't optimized away.
           if (RK.WasOn == V && RK.AttrKind == Attribute::Alignment &&
               isPowerOf2_64(RK.ArgValue) &&
-              isValidAssumeForContext(I, Q.CxtI, Q.DT, /*AllowEphemerals*/ true))
+              isValidAssumeForContext(I, Q.CxtI, Q.DT,
+                                      /*AllowEphemerals*/ true))
             Known.Zero.setLowBits(Log2_64(RK.ArgValue));
         }
       } else if (V->getType()->isIntOrIntVectorTy()) {

``````````

</details>


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


More information about the llvm-commits mailing list