if (CI->hasUnsafeAlgebra()) {
IRBuilder<>::FastMathFlagGuard Guard(B);
B.setFastMathFlags(CI->getFastMathFlags());
- return emitUnaryFloatFnCall(Op1, TLI->getName(LibFunc::sqrt), B,
- Callee->getAttributes());
+ Value *Sqrt = Intrinsic::getDeclaration(CI->getModule(), Intrinsic::sqrt,
+ Op1->getType());
+ return B.CreateCall(Sqrt, Op1, "sqrt");
}
// Expand pow(x, 0.5) to (x == -infinity ? +infinity : fabs(sqrt(x))).
}
; CHECK-LABEL: define double @pow_half(
-; CHECK-NEXT: %sqrt = call fast double @sqrt(double %x)
+; CHECK-NEXT: %sqrt = call fast double @llvm.sqrt.f64(double %x)
; CHECK-NEXT: ret double %sqrt
declare double @llvm.pow.f64(double, double)