diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-04-10 02:07:51 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-04-10 02:07:51 +0000 |
| commit | a29d2536aa5c35d8920518fa3c3401aedc310909 (patch) | |
| tree | fdff783ea25e62dda8052f9a048f01a38e8093de /llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp | |
| parent | 2025a490d0df87099b80eadd1afe28868a399f55 (diff) | |
| download | bcm5719-llvm-a29d2536aa5c35d8920518fa3c3401aedc310909.tar.gz bcm5719-llvm-a29d2536aa5c35d8920518fa3c3401aedc310909.zip | |
Disable an xform we've had for a long time, pow(x,0.5) -> sqrt.
This is not safe for all inputs.
llvm-svn: 49458
Diffstat (limited to 'llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp')
| -rw-r--r-- | llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp b/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp index f7bc59fd2ee..6e4ac5ae4ae 100644 --- a/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp @@ -1179,9 +1179,17 @@ public: // 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); |

