[llvm] [SimplifyLibCalls] fdim constant fold (PR #109235)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 9 08:12:58 PDT 2024
================
@@ -3109,6 +3109,50 @@ Value *LibCallSimplifier::optimizeRemquo(CallInst *CI, IRBuilderBase &B) {
return ConstantFP::get(CI->getType(), Rem);
}
+/// Constant folds fdim
+Value *LibCallSimplifier::optimizeFdim(CallInst *CI, IRBuilderBase &B) {
+ // Cannot perform the fold unless the call has attribute memory(none)
+ if (!CI->doesNotAccessMemory())
+ return nullptr;
+
+ // TODO : Handle undef values
+ // propagate poison if any
----------------
arsenm wrote:
```suggestion
// Propagate poison if any
```
https://github.com/llvm/llvm-project/pull/109235
More information about the llvm-commits
mailing list