Skip to content

Commit

Permalink
Revert "Remove sqrt from the volatile list (#43786)"
Browse files Browse the repository at this point in the history
This reverts commit cc96240.
  • Loading branch information
simeonschaub committed Jan 31, 2022
1 parent a7beb93 commit 3520059
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
1 change: 1 addition & 0 deletions base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions test/compiler/inline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,3 @@ let
ftest(a) = (fcond(a, nothing); a)
@test fully_eliminated(ftest, Tuple{Bool})
end

# sqrt not considered volatile
f_sqrt() = sqrt(2)
@test fully_eliminated(f_sqrt, Tuple{})
4 changes: 1 addition & 3 deletions test/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3520059

Please sign in to comment.