[llvm] [SimplifyLibCalls] fdim constant fold (PR #109235)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 25 06:23:07 PDT 2024
================
@@ -3109,6 +3109,32 @@ Value *LibCallSimplifier::optimizeRemquo(CallInst *CI, IRBuilderBase &B) {
return ConstantFP::get(CI->getType(), Rem);
}
+/// Constant folds fdim
+Value *LibCallSimplifier::optimizeFdim(CallInst *CI, IRBuilderBase &B) {
+ const APFloat *X, *Y;
+ // Check if both values are constants
+ if (!match(CI->getArgOperand(0), m_APFloat(X)) ||
+ !match(CI->getArgOperand(1), m_APFloat(Y)))
+ return nullptr;
----------------
braw-lee wrote:
not sure what you mean by that,
we need the NaN check and i don't see if we can do that through a `Value*`, we need to transform it to constant
can you suggest any alternatives here?
https://github.com/llvm/llvm-project/pull/109235
More information about the llvm-commits
mailing list