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

Kshitij Paranjape via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 23:37:47 PST 2025


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

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

>From 5f29f640f60bb92d6eebbd8eb13a0a6aa967dcb3 Mon Sep 17 00:00:00 2001
From: Kshitij Paranjape <kshitijvparanjape at gmail.com>
Date: Sat, 11 Jan 2025 12:40:23 +0530
Subject: [PATCH] [LibCallShrinkWrap] Added ilogb in performCallErrors()

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
---
 llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp | 1 +
 1 file changed, 1 insertion(+)

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);



More information about the llvm-commits mailing list