From 9d028c26c81cb15d79f46a187caee646d3bcd347 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 17 Jun 2006 18:17:52 +0000 Subject: [PATCH] Constant fold sqrtf llvm-svn: 28853 --- lib/Analysis/ConstantFolding.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index 3321115c53e..7e802ba7dd6 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -76,7 +76,8 @@ llvm::canConstantFoldCallTo(Function *F) { case 'p': return Name == "pow"; case 's': - return Name == "sin" || Name == "sinh" || Name == "sqrt"; + return Name == "sin" || Name == "sinh" || + Name == "sqrt" || Name == "sqrtf"; case 't': return Name == "tan" || Name == "tanh"; default: @@ -150,6 +151,8 @@ llvm::ConstantFoldCall(Function *F, const std::vector &Operands) { return ConstantFP::get(Ty, sinh(V)); else if (Name == "sqrt" && V >= 0) return ConstantFP::get(Ty, sqrt(V)); + else if (Name == "sqrtf" && V >= 0) + return ConstantFP::get(Ty, sqrt((float)V)); break; case 't': if (Name == "tan")