[llvm] [SimplifyLibCalls] Recognize and simplify f[min/max]imumnum (PR #170699)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 5 14:34:02 PST 2025
================
@@ -2543,6 +2543,30 @@ Value *LibCallSimplifier::optimizeFMinFMax(CallInst *CI, IRBuilderBase &B) {
CI->getArgOperand(1), FMF));
}
+Value *LibCallSimplifier::optimizeFMinimumnumFMaximumnum(CallInst *CI,
+ IRBuilderBase &B) {
+ Module *M = CI->getModule();
+
+ // If we can shrink the call to a float function rather than a double
+ // function, do that first.
+ Function *Callee = CI->getCalledFunction();
+ StringRef Name = Callee->getName();
+ if ((Name == "fminimum_num" || Name == "fmaximum_num") &&
----------------
arsenm wrote:
Why does this need the string compare? TargetLibraryInfo should have already parsed this into an enum LibFunc in the caller? Pass that down?
https://github.com/llvm/llvm-project/pull/170699
More information about the llvm-commits
mailing list