[PATCH] D156892: AMDGPU: Delete probably wrong constant folding of expm1

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 06:58:16 PDT 2023


arsenm created this revision.
arsenm added reviewers: AMDGPU, rampitec, foad, Pierre-vh, jmmartinez.
Herald added subscribers: StephenFan, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

It's not really correct to implement this as exp(x) - 1, it was maybe
OK for the restricted float-as-double case handled here. There's not a
strong reason to special case it with the host function, as the
implementation naturally constant folds anyway. InstSimplify can fully
handle everything in it, so just running the inliner alone with a
constant argument produces the fully constant folded result. This also
had no tests.


https://reviews.llvm.org/D156892

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


Index: llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
@@ -1290,10 +1290,6 @@
     Res0 = pow(10.0, opr0);
     return true;
 
-  case AMDGPULibFunc::EI_EXPM1:
-    Res0 = exp(opr0) - 1.0;
-    return true;
-
   case AMDGPULibFunc::EI_LOG:
     Res0 = log(opr0);
     return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156892.546449.patch
Type: text/x-patch
Size: 435 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230802/61378309/attachment.bin>


More information about the llvm-commits mailing list