diff --git a/base/compiler/optimize.jl b/base/compiler/optimize.jl index b136a857d507a..3d12d2634c907 100644 --- a/base/compiler/optimize.jl +++ b/base/compiler/optimize.jl @@ -621,6 +621,7 @@ function is_pure_intrinsic_infer(f::IntrinsicFunction) f === Intrinsics.pointerset || # this one is never effect-free f === Intrinsics.llvmcall || # this one is never effect-free f === Intrinsics.arraylen || # this one is volatile + f === Intrinsics.sqrt_llvm || # this one may differ at runtime (by a few ulps) f === Intrinsics.sqrt_llvm_fast || # this one may differ at runtime (by a few ulps) f === Intrinsics.have_fma || # this one depends on the runtime environment f === Intrinsics.cglobal) # cglobal lookup answer changes at runtime diff --git a/test/compiler/inline.jl b/test/compiler/inline.jl index 75dce54a0cc53..a551f3db3233b 100644 --- a/test/compiler/inline.jl +++ b/test/compiler/inline.jl @@ -892,10 +892,6 @@ let @test fully_eliminated(ftest, Tuple{Bool}) end -# sqrt not considered volatile -f_sqrt() = sqrt(2) -@test fully_eliminated(f_sqrt, Tuple{}) - # use constant prop' result even when the return type doesn't get refined const Gx = Ref{Any}() Base.@constprop :aggressive function conditional_escape!(cnd, x) diff --git a/test/math.jl b/test/math.jl index af280066f2f22..33c03c610f7d5 100644 --- a/test/math.jl +++ b/test/math.jl @@ -1386,11 +1386,9 @@ end # Runtime version @test sqrt(x) === y # Interpreter compile-time version - @test Base.invokelatest((@eval ()->sqrt(Base.inferencebarrier($x)))) == y - # Inference const-prop version @test Base.invokelatest((@eval ()->sqrt($x))) == y # LLVM constant folding version - @test Base.invokelatest((@eval ()->(@force_compile; sqrt(Base.inferencebarrier($x))))) == y + @test Base.invokelatest((@eval ()->(@force_compile; sqrt($x)))) == y end end