[llvm] GVN: generalize impliesEquivalence (NFC) (PR #111416)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 11:19:54 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 971b579bc6669a0898e47d6702c4b99cb757bb26 c75fa1cca180b977218dfce51621f8d2d23b8fa7 --extensions cpp -- llvm/lib/Transforms/Scalar/GVN.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 315ffe4c04..f31ad82f60 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -1999,16 +1999,16 @@ static bool impliesEquivalanceIfTrue(CmpInst* Cmp) {
   if (Cmp->getPredicate() == CmpInst::Predicate::FCMP_OEQ ||
       (Cmp->getPredicate() == CmpInst::Predicate::FCMP_UEQ &&
        Cmp->hasNoNaNs())) {
-      Value *LHS = Cmp->getOperand(0);
-      Value *RHS = Cmp->getOperand(1);
-      // If we can prove either side non-zero, then equality must imply
-      // equivalence.
-      auto *ConstLHS = dyn_cast<Constant>(LHS),
-           *ConstRHS = dyn_cast<Constant>(RHS);
-      if (auto *Const = ConstLHS ? ConstLHS : ConstRHS) {
-        if (!Const->isZeroValue())
-          return true;
-      }
+    Value *LHS = Cmp->getOperand(0);
+    Value *RHS = Cmp->getOperand(1);
+    // If we can prove either side non-zero, then equality must imply
+    // equivalence.
+    auto *ConstLHS = dyn_cast<Constant>(LHS),
+         *ConstRHS = dyn_cast<Constant>(RHS);
+    if (auto *Const = ConstLHS ? ConstLHS : ConstRHS) {
+      if (!Const->isZeroValue())
+        return true;
+    }
   }
   return false;
 }
@@ -2023,16 +2023,16 @@ static bool impliesEquivalanceIfFalse(CmpInst* Cmp) {
   if ((Cmp->getPredicate() == CmpInst::Predicate::FCMP_ONE &&
        Cmp->hasNoNaNs()) ||
       Cmp->getPredicate() == CmpInst::Predicate::FCMP_UNE) {
-      Value *LHS = Cmp->getOperand(0);
-      Value *RHS = Cmp->getOperand(1);
-      // If we can prove either side non-zero, then equality must imply
-      // equivalence.
-      auto *ConstLHS = dyn_cast<Constant>(LHS),
-           *ConstRHS = dyn_cast<Constant>(RHS);
-      if (auto *Const = ConstLHS ? ConstLHS : ConstRHS) {
-        if (!Const->isZeroValue())
-          return true;
-      }
+    Value *LHS = Cmp->getOperand(0);
+    Value *RHS = Cmp->getOperand(1);
+    // If we can prove either side non-zero, then equality must imply
+    // equivalence.
+    auto *ConstLHS = dyn_cast<Constant>(LHS),
+         *ConstRHS = dyn_cast<Constant>(RHS);
+    if (auto *Const = ConstLHS ? ConstLHS : ConstRHS) {
+      if (!Const->isZeroValue())
+        return true;
+    }
   }
   return false;
 }

``````````

</details>


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


More information about the llvm-commits mailing list