i have a cache that looks like:
struct Cache
{
mutating
func load(_ key:Int, context:Context) throws -> Item
}
where both Cache and Context are value types.
i have a lot of code that uses Cache that looks like:
func foo(x:Int, context:Context, cache:inout Cache) throws
{
let item:Item = try cache.load(x, context: context)
try bar(y: x, context: context, cache: &cache)
}
func bar(y:Int, context:Context, cache:inout Cache) throws
{
let item:Item = try cache.load(y, context: context)
}
and i would like the optimizer to be able to optimize away the second call to Cache.load(_:context:) in bar(y:context:cache:), since the key and context are unchanged.
can i use @_effects(readnone) to achieve this?