[llvm] [SimplifyLibCalls] Move constant folding logic in `ConstantFoldLibCall2` (PR #172139)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 08:00:52 PDT 2026
================
@@ -3391,6 +3392,20 @@ static Constant *ConstantFoldLibCall2(StringRef Name, Type *Ty,
if (TLI->has(Func))
return ConstantFoldBinaryFP(pow, Op1V, Op2V, Ty);
break;
+ case LibFunc_fdim:
+ case LibFunc_fdimf:
+ case LibFunc_fdiml:
+ if (TLI->has(Func)) {
+ // C99 fdim(x, y) = (x > y) ? x - y : +0.
+ if (!Op1V.isNaN() && !Op2V.isNaN() &&
+ Op1V.compare(Op2V) != APFloat::cmpGreaterThan){
----------------
dtcxzyw wrote:
Drop braces.
https://github.com/llvm/llvm-project/pull/172139
More information about the llvm-commits
mailing list