Index: clang/lib/CodeGen/CGBuiltin.cpp =================================================================== --- clang/lib/CodeGen/CGBuiltin.cpp +++ clang/lib/CodeGen/CGBuiltin.cpp @@ -495,6 +495,8 @@ unsigned ConstrainedIntrinsicID) { llvm::Value *Src0 = CGF.EmitScalarExpr(E->getArg(0)); + CodeGenFunction::CGFPOptionsRAII FPOptsRAII( + CGF, E->getFPFeaturesInEffect(CGF.getLangOpts())); if (CGF.Builder.getIsFPConstrained()) { CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, E); Function *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID, Src0->getType()); Index: clang/test/CodeGen/fp-contract-fast-pragma.cpp =================================================================== --- clang/test/CodeGen/fp-contract-fast-pragma.cpp +++ clang/test/CodeGen/fp-contract-fast-pragma.cpp @@ -5,8 +5,10 @@ // CHECK: _Z13fp_contract_1fff // CHECK: %[[M:.+]] = fmul contract float %a, %b // CHECK-NEXT: fadd contract float %[[M]], %c +// CHECK-NEXT: tail call contract float @llvm.sqrt.f32(float %a) + #pragma clang fp contract(fast) - return a * b + c; + return a * b + c + __builtin_sqrtf(a); } // Is FP_CONTRACT state cleared on exiting compound statements?