[llvm] [AMDGPU][NFC] Simplify needcopysign logic (PR #75176)

Jakub Chlanda via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 05:39:53 PST 2023


https://github.com/jchlanda updated https://github.com/llvm/llvm-project/pull/75176

>From cb7a4b4f7964930b41749d7f556fda79d21f5dfb Mon Sep 17 00:00:00 2001
From: Jakub Chlanda <jakub at codeplay.com>
Date: Tue, 12 Dec 2023 11:19:13 +0000
Subject: [PATCH] [AMDGPU][NFC] Simplify needcopysign logic

This was caught by coverity, reported as: `dead_error_condition`.
Since the conditional revolves around `CF`, it is guaranteed to be null
in the else clause, hence making the second part of the statement
redundant.
---
 llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
index 5c66fd2b180f76..fa354cc13d5007 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
@@ -1051,8 +1051,7 @@ bool AMDGPULibCalls::fold_pow(FPMathOperator *FPOp, IRBuilder<> &B,
                      CF->isNegative();
     } else {
       needlog = true;
-      needcopysign = needabs = FInfo.getId() != AMDGPULibFunc::EI_POWR &&
-                               (!CF || CF->isNegative());
+      needcopysign = needabs = FInfo.getId() != AMDGPULibFunc::EI_POWR;
     }
   } else {
     ConstantDataVector *CDV = dyn_cast<ConstantDataVector>(opr0);



More information about the llvm-commits mailing list