[llvm] [ValueTracking] Expand cmpExcludesZero to optionally work with non-constant RHS (PR #69364)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 17 11:19:43 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 ddc30ff802eb135934fc7b785d33c05217ab9e39 e768cd016daafe105bbc6808dbd26b87adc5f89c -- llvm/lib/Analysis/ValueTracking.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 6a92f2247b46..5fdb7758503b 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -578,14 +578,14 @@ static bool cmpExcludesZero(CmpInst::Predicate Pred, Value *RHS,
     for (EleIdx = 0, NEle = FVTy->getNumElements(); EleIdx < NEle; ++EleIdx) {
       Constant *EleC = VC->getAggregateElement(EleIdx);
       if (EleC == nullptr)
-       break;
+        break;
       const APInt *EleCI;
       if (!match(EleC, m_APInt(EleCI)))
-       break;
+        break;
       ConstantRange TrueValues =
           ConstantRange::makeExactICmpRegion(Pred, *EleCI);
       if (TrueValues.contains(APInt::getZero(EleCI->getBitWidth())))
-       break;
+        break;
     }
     if (EleIdx == NEle)
       return true;

``````````

</details>


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


More information about the llvm-commits mailing list