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 Feb 4, 2022
1 parent bd9c510 commit 70d8e4a
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 @@ -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)
Expand Down
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 70d8e4a

Please sign in to comment.