[llvm-commits] CVS: llvm/lib/Transforms/Utils/Local.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Sep 27 18:34:43 PDT 2005
Changes in directory llvm/lib/Transforms/Utils:
Local.cpp updated: 1.43 -> 1.44
---
Log message:
Constant fold llvm.sqrt
---
Diffs of the changes: (+9 -1)
Local.cpp | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletion(-)
Index: llvm/lib/Transforms/Utils/Local.cpp
diff -u llvm/lib/Transforms/Utils/Local.cpp:1.43 llvm/lib/Transforms/Utils/Local.cpp:1.44
--- llvm/lib/Transforms/Utils/Local.cpp:1.43 Mon Sep 26 00:27:10 2005
+++ llvm/lib/Transforms/Utils/Local.cpp Tue Sep 27 20:34:32 2005
@@ -240,7 +240,9 @@
const std::string &Name = F->getName();
switch (F->getIntrinsicID()) {
- case Intrinsic::isunordered: return true;
+ case Intrinsic::isunordered:
+ case Intrinsic::sqrt:
+ return true;
default: break;
}
@@ -321,6 +323,12 @@
return ConstantFP::get(Ty, log(V));
else if (Name == "log10" && V > 0)
return ConstantFoldFP(log10, V, Ty);
+ else if (Name == "llvm.sqrt") {
+ if (V >= -0.0)
+ return ConstantFP::get(Ty, sqrt(V));
+ else // Undefined
+ return ConstantFP::get(Ty, 0.0);
+ }
break;
case 's':
if (Name == "sin")
More information about the llvm-commits
mailing list