[llvm-commits] CVS: llvm/lib/Analysis/ConstantFolding.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Jun 17 11:18:05 PDT 2006



Changes in directory llvm/lib/Analysis:

ConstantFolding.cpp updated: 1.3 -> 1.4
---
Log message:

Constant fold sqrtf


---
Diffs of the changes:  (+4 -1)

 ConstantFolding.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/Analysis/ConstantFolding.cpp
diff -u llvm/lib/Analysis/ConstantFolding.cpp:1.3 llvm/lib/Analysis/ConstantFolding.cpp:1.4
--- llvm/lib/Analysis/ConstantFolding.cpp:1.3	Mon Jan 16 15:12:35 2006
+++ llvm/lib/Analysis/ConstantFolding.cpp	Sat Jun 17 13:17:52 2006
@@ -76,7 +76,8 @@
     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 @@
             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")






More information about the llvm-commits mailing list