[llvm] [InstCombine] Fold xored one-complemented operand comparisons (PR #69882)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 22 08:20:58 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 4f56d47d050e3d71964777151e439fe923e64025 1a4e700abfa7c9b84c9817cf95f33f0d69dffc53 -- llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 4c19edfb27d2..45ee2ff3cf6f 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -6933,16 +6933,25 @@ static Instruction *foldReductionIdiom(ICmpInst &I,
 // it doesn't change the equality, e.g SLE <-> SGE, SLT <-> SGT,
 // ULE <-> UGE, ULT <-> UGT
 static ICmpInst::Predicate ConvertPred(ICmpInst::Predicate Pred) {
-  switch(Pred) {
-    case ICmpInst::ICMP_SLE: return ICmpInst::ICMP_SGE;
-    case ICmpInst::ICMP_SGE: return ICmpInst::ICMP_SLE;
-    case ICmpInst::ICMP_SLT: return ICmpInst::ICMP_SGT;
-    case ICmpInst::ICMP_SGT: return ICmpInst::ICMP_SLT;
-    case ICmpInst::ICMP_ULE: return ICmpInst::ICMP_UGE;
-    case ICmpInst::ICMP_UGE: return ICmpInst::ICMP_ULE;
-    case ICmpInst::ICMP_ULT: return ICmpInst::ICMP_UGT;
-    case ICmpInst::ICMP_UGT: return ICmpInst::ICMP_ULT;
-    default: llvm_unreachable("Invalid Predicate");
+  switch (Pred) {
+  case ICmpInst::ICMP_SLE:
+    return ICmpInst::ICMP_SGE;
+  case ICmpInst::ICMP_SGE:
+    return ICmpInst::ICMP_SLE;
+  case ICmpInst::ICMP_SLT:
+    return ICmpInst::ICMP_SGT;
+  case ICmpInst::ICMP_SGT:
+    return ICmpInst::ICMP_SLT;
+  case ICmpInst::ICMP_ULE:
+    return ICmpInst::ICMP_UGE;
+  case ICmpInst::ICMP_UGE:
+    return ICmpInst::ICMP_ULE;
+  case ICmpInst::ICMP_ULT:
+    return ICmpInst::ICMP_UGT;
+  case ICmpInst::ICMP_UGT:
+    return ICmpInst::ICMP_ULT;
+  default:
+    llvm_unreachable("Invalid Predicate");
   }
 }
 

``````````

</details>


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


More information about the llvm-commits mailing list