Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,6 @@ 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: 4 additions & 0 deletions test/compiler/inline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -891,3 +891,7 @@ 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: 3 additions & 1 deletion test/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1386,8 +1386,10 @@ 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($x)))) == y
@test Base.invokelatest((@eval ()->(@force_compile; sqrt(Base.inferencebarrier($x))))) == y
end
end