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

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 01:06:52 PDT 2024


https://github.com/abhishek-kaushik22 created https://github.com/llvm/llvm-project/pull/105629

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`.

>From f42862846fca5460928776ea3590cd6eec9f5a47 Mon Sep 17 00:00:00 2001
From: abhishek-kaushik22 <abhishek.kaushik at intel.com>
Date: Thu, 22 Aug 2024 13:36:03 +0530
Subject: [PATCH] Remove redundant ternary operator in conditional check

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`.
---
 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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
 



More information about the llvm-commits mailing list