[llvm] [InstCombine] Lower ilogb to bit operations for normal values (PR #218044)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 06:26:45 PDT 2026


================
@@ -3239,6 +3239,59 @@ Value *LibCallSimplifier::optimizeFdim(CallInst *CI, IRBuilderBase &B) {
   return ConstantFP::get(CI->getType(), Difference);
 }
 
+Value *LibCallSimplifier::optimizeILogB(CallInst *CI, IRBuilderBase &B) {
+  // Prevent the optimization from re-triggering and causing the fixpoint error.
+  if (CI->use_empty())
+    return nullptr;
+
+  Value *X = CI->getArgOperand(0);
+  Type *FTy = X->getType();
+
+  // Restricted to standard IEEE floats, doubles and fp128
+  if (!FTy->isFloatTy() && !FTy->isDoubleTy() && !FTy->isFP128Ty())
----------------
tadeuszjt wrote:

Added in the latest push

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


More information about the llvm-commits mailing list