@@ -1427,3 +1427,37 @@ end |> !Compiler.is_nothrow
14271427@test Base. infer_effects ((UInt64,)) do x
14281428 return Core. Intrinsics. uitofp (Int64, x)
14291429end |> ! Compiler. is_nothrow
1430+
1431+ # effects modeling for pointer-related intrinsics
1432+ let effects = Base. infer_effects (Core. Intrinsics. pointerref, Tuple{Vararg{Any}})
1433+ @test ! Compiler. is_consistent (effects)
1434+ @test Compiler. is_effect_free (effects)
1435+ @test ! Compiler. is_inaccessiblememonly (effects)
1436+ end
1437+ let effects = Base. infer_effects (Core. Intrinsics. pointerset, Tuple{Vararg{Any}})
1438+ @test Compiler. is_consistent (effects)
1439+ @test ! Compiler. is_effect_free (effects)
1440+ end
1441+ # effects modeling for atomic intrinsics
1442+ # these functions especially need to be marked !effect_free since they imply synchronization
1443+ for atomicfunc = Any[
1444+ Core. Intrinsics. atomic_pointerref,
1445+ Core. Intrinsics. atomic_pointerset,
1446+ Core. Intrinsics. atomic_pointerswap,
1447+ Core. Intrinsics. atomic_pointerreplace,
1448+ Core. Intrinsics. atomic_fence]
1449+ @test ! Compiler. is_effect_free (Base. infer_effects (atomicfunc, Tuple{Vararg{Any}}))
1450+ end
1451+
1452+ # effects modeling for intrinsics that can do arbitrary things
1453+ let effects = Base. infer_effects (Core. Intrinsics. llvmcall, Tuple{Vararg{Any}})
1454+ @test effects == Compiler. Effects ()
1455+ end
1456+ let effects = Base. infer_effects (Core. Intrinsics. atomic_pointermodify, Tuple{Vararg{Any}})
1457+ @test effects == Compiler. Effects ()
1458+ end
1459+
1460+ # JuliaLang/julia#57780
1461+ let effects = Base. infer_effects (Base. _unsetindex!, (MemoryRef{String},))
1462+ @test ! Compiler. is_effect_free (effects)
1463+ end
0 commit comments