diff options
author | John McCall <rjmccall@apple.com> | 2010-04-07 08:20:20 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-04-07 08:20:20 +0000 |
commit | beb41281f8355caa05700d0a77539defbdf428f8 (patch) | |
tree | 2590732ec5274160f2fab454e74345bdc1a78885 /lib/CodeGen | |
parent | fc1a9c312d249a2c7458f763f848ba42685c23f8 (diff) |
@llvm.sqrt isn't really close enough to C's sqrt to justify emitting calls
to the intrinsic, even when math-errno is off.
Fixes rdar://problem/7828230 by falling back on the library function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100613 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGBuiltin.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index 38c40ed489..a46cc39efa 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -682,13 +682,12 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, case Builtin::BIsqrt: case Builtin::BIsqrtf: case Builtin::BIsqrtl: { - // Rewrite sqrt to intrinsic if allowed. - if (!FD->hasAttr<ConstAttr>()) - break; - Value *Arg0 = EmitScalarExpr(E->getArg(0)); - const llvm::Type *ArgType = Arg0->getType(); - Value *F = CGM.getIntrinsic(Intrinsic::sqrt, &ArgType, 1); - return RValue::get(Builder.CreateCall(F, Arg0, "tmp")); + // TODO: there is currently no set of optimizer flags + // sufficient for us to rewrite sqrt to @llvm.sqrt. + // -fmath-errno=0 is not good enough; we need finiteness. + // We could probably precondition the call with an ult + // against 0, but is that worth the complexity? + break; } case Builtin::BIpow: |