[llvm-commits] [llvm] r49458 - /llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp
Chris Lattner
sabre at nondot.org
Wed Apr 9 19:07:51 PDT 2008
Author: lattner
Date: Wed Apr 9 21:07:51 2008
New Revision: 49458
URL: http://llvm.org/viewvc/llvm-project?rev=49458&view=rev
Log:
Disable an xform we've had for a long time, pow(x,0.5) -> sqrt.
This is not safe for all inputs.
Modified:
llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp
Modified: llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp?rev=49458&r1=49457&r2=49458&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp Wed Apr 9 21:07:51 2008
@@ -1179,9 +1179,17 @@
// pow(x, 0.0) -> 1.0
return ReplaceCallWith(CI, ConstantFP::get(CI->getType(), 1.0));
} else if (Op2C->isExactlyValue(0.5)) {
+ // FIXME: This is not safe for -0.0 and -inf. This can only be done when
+ // 'unsafe' math optimizations are allowed.
+ // x pow(x, 0.5) sqrt(x)
+ // ---------------------------------------------
+ // -0.0 +0.0 -0.0
+ // -inf +inf NaN
+#if 0
// pow(x, 0.5) -> sqrt(x)
Value *Sqrt = CallInst::Create(SLC.get_sqrt(), Op1, "sqrt", CI);
return ReplaceCallWith(CI, Sqrt);
+#endif
} else if (Op2C->isExactlyValue(1.0)) {
// pow(x, 1.0) -> x
return ReplaceCallWith(CI, Op1);
More information about the llvm-commits
mailing list