[llvm] Remove redundant ternary operator in conditional check (PR #105629)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 01:07:21 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-selectiondag

Author: None (abhishek-kaushik22)

<details>
<summary>Changes</summary>

The ternary operator in the second `if` statement was redundant because `IsOrdered` is already checked to be `false` in the outer `if` statement. Simplified the code by directly using `UnorderedOp`.

---
Full diff: https://github.com/llvm/llvm-project/pull/105629.diff


1 Files Affected:

- (modified) llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 4e796289cff0a1..0aee129de83c2f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -8755,7 +8755,7 @@ SDValue TargetLowering::expandIS_FPCLASS(EVT ResultVT, SDValue Op,
       ISD::CondCode OrderedOp = IsInverted ? ISD::SETUGE : ISD::SETOLT;
       ISD::CondCode UnorderedOp = IsInverted ? ISD::SETOGE : ISD::SETULT;
 
-      if (isCondCodeLegalOrCustom(IsOrdered ? OrderedOp : UnorderedOp,
+      if (isCondCodeLegalOrCustom(UnorderedOp,
                                   OperandVT.getScalarType().getSimpleVT())) {
         // (issubnormal(x) || iszero(x)) --> fabs(x) < smallest_normal
 

``````````

</details>


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


More information about the llvm-commits mailing list