[llvm] [FuncSpec] Improve handling of Comparison Instructions (PR #114073)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 08:44:16 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 340cd4e631d72d02cd79f9aad74d2a354abc977e 3c03c26aae3752bf8f66323a0dffb2c0781304e6 --extensions cpp -- llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
index 2c1f29d719..7478e089f4 100644
--- a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
@@ -474,10 +474,10 @@ Constant *InstCostVisitor::visitCmpInst(CmpInst &I) {
   Constant *Other = findConstantFor(V, KnownConstants);
 
   if (Other)
-  return Swap ? ConstantFoldCompareInstOperands(I.getPredicate(), Other, Const,
-                                                DL)
-              : ConstantFoldCompareInstOperands(I.getPredicate(), Const, Other,
-                                                DL);
+    return Swap ? ConstantFoldCompareInstOperands(I.getPredicate(), Other,
+                                                  Const, DL)
+                : ConstantFoldCompareInstOperands(I.getPredicate(), Const,
+                                                  Other, DL);
 
   // If we haven't found Other to be a specific constant value, we may still be
   // able constant fold the comparison using information from the lattice value.
@@ -487,7 +487,6 @@ Constant *InstCostVisitor::visitCmpInst(CmpInst &I) {
   auto &V1State = Swap ? OtherLV : ConstLV;
   auto &V2State = Swap ? ConstLV : OtherLV;
   return V1State.getCompare(I.getPredicate(), I.getType(), V2State, DL);
-
 }
 
 Constant *InstCostVisitor::visitUnaryOperator(UnaryOperator &I) {

``````````

</details>


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


More information about the llvm-commits mailing list