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

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 03:07:25 PST 2023


Author: Jakub Chlanda
Date: 2023-12-18T12:07:22+01:00
New Revision: a34db9bdefe6d60b46f485aa1105ef6c95542e16

URL: https://github.com/llvm/llvm-project/commit/a34db9bdefe6d60b46f485aa1105ef6c95542e16
DIFF: https://github.com/llvm/llvm-project/commit/a34db9bdefe6d60b46f485aa1105ef6c95542e16.diff

LOG: [AMDGPU][NFC] Simplify needcopysign logic (#75176)

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.

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
index 0c21382e5c225e..f03e6b8915b134 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
@@ -1050,8 +1050,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