Skip to content

[ConstantFold] Special case log1p +/-0.0 #114635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions llvm/lib/Analysis/ConstantFolding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2407,6 +2407,9 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
break;
case LibFunc_log1p:
case LibFunc_log1pf:
// Implement optional behavior from C's Annex F for +/-0.0.
if (U.isZero())
return ConstantFP::get(Ty->getContext(), U);
if (APF > APFloat::getOne(APF.getSemantics(), true) && TLI->has(Func))
return ConstantFoldFP(log1p, APF, Ty);
break;
Expand Down
1 change: 0 additions & 1 deletion llvm/test/Transforms/InstCombine/log1p.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
; XFAIL: target={{.*}}-aix{{.*}}
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt < %s -passes=instcombine -S | FileCheck %s

Expand Down
Loading