[llvm] [LibCallShrinkWrap] Added ilogb in performCallErrors() (PR #122582)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 23:38:41 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Kshitij Paranjape (kshitijvp)

<details>
<summary>Changes</summary>

ilogb libcall was not being constant folded correctly. It was due to LibCallShrinkWrap pass not handling
ilogbx, as a result SimplifyCFG pass did not remove redundant libcall. This patch adds ilogb case in
performCallErrors().

Fixes #<!-- -->101873

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


1 Files Affected:

- (modified) llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp (+1) 


``````````diff
diff --git a/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp b/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
index 9fe655e548c22c..1316137ca4f96b 100644
--- a/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
+++ b/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
@@ -246,6 +246,7 @@ bool LibCallsShrinkWrap::performCallErrors(CallInst *CI,
   case LibFunc_logb:   // Same as log
   case LibFunc_logbf:  // Same as log
   case LibFunc_logbl:  // Same as log
+  case LibFunc_ilogb:  // Same as log
   {
     ++NumWrappedOneCond;
     Cond = createCond(CI, CmpInst::FCMP_OLE, 0.0f);

``````````

</details>


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


More information about the llvm-commits mailing list