@@ -1875,6 +1875,30 @@ const _ARGMEM_BUILTINS = Any[
18751875 swapfield!,
18761876]
18771877
1878+ const _INCONSISTENT_INTRINSICS = Any[
1879+ Intrinsics. pointerref, # this one is volatile
1880+ Intrinsics. arraylen, # this one is volatile
1881+ Intrinsics. sqrt_llvm_fast, # this one may differ at runtime (by a few ulps)
1882+ Intrinsics. have_fma, # this one depends on the runtime environment
1883+ Intrinsics. cglobal, # cglobal lookup answer changes at runtime
1884+ # ... and list fastmath intrinsics:
1885+ # join(string.("Intrinsics.", sort(filter(endswith("_fast")∘string, names(Core.Intrinsics)))), ",\n")
1886+ Intrinsics. add_float_fast,
1887+ Intrinsics. div_float_fast,
1888+ Intrinsics. eq_float_fast,
1889+ Intrinsics. le_float_fast,
1890+ Intrinsics. lt_float_fast,
1891+ Intrinsics. mul_float_fast,
1892+ Intrinsics. ne_float_fast,
1893+ Intrinsics. neg_float_fast,
1894+ Intrinsics. rem_float_fast,
1895+ Intrinsics. sqrt_llvm_fast,
1896+ Intrinsics. sub_float_fast
1897+ # TODO needs to revive #31193 to mark this as inconsistent to be accurate
1898+ # while preserving the currently optimizations for many math operations
1899+ # Intrinsics.muladd_float, # this is not interprocedurally consistent
1900+ ]
1901+
18781902const _SPECIAL_BUILTINS = Any[
18791903 Core. _apply_iterate,
18801904]
@@ -2142,13 +2166,7 @@ function intrinsic_effects(f::IntrinsicFunction, argtypes::Vector{Any})
21422166 return Effects ()
21432167 end
21442168
2145- consistent = ! (
2146- f === Intrinsics. pointerref || # this one is volatile
2147- f === Intrinsics. arraylen || # this one is volatile
2148- f === Intrinsics. sqrt_llvm_fast || # this one may differ at runtime (by a few ulps)
2149- f === Intrinsics. have_fma || # this one depends on the runtime environment
2150- f === Intrinsics. cglobal # cglobal lookup answer changes at runtime
2151- ) ? ALWAYS_TRUE : ALWAYS_FALSE
2169+ consistent = contains_is (_INCONSISTENT_INTRINSICS, f) ? ALWAYS_FALSE : ALWAYS_TRUE
21522170 effect_free = ! (f === Intrinsics. pointerset) ? ALWAYS_TRUE : ALWAYS_FALSE
21532171 nothrow = (! (! isempty (argtypes) && isvarargtype (argtypes[end ])) && intrinsic_nothrow (f, argtypes))
21542172
0 commit comments