From 55e10b277ffea1faae227b1ee40a77be84f7b6ca Mon Sep 17 00:00:00 2001 From: Matt Bauman Date: Mon, 27 Apr 2020 17:22:37 -0500 Subject: [PATCH] Be more optimistic about the world but still provide the hook for arrays to improve --- base/broadcast.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base/broadcast.jl b/base/broadcast.jl index 900e10bff4a62..2e04745634f1b 100644 --- a/base/broadcast.jl +++ b/base/broadcast.jl @@ -897,13 +897,13 @@ broadcast_unalias(::Nothing, src) = src """ potentially_self_aliased(A) -Conservatively returns true if multiple locations in `A` might reference the same memory +Returns true if multiple locations in `A` reference the same memory """ potentially_self_aliased(::DenseArray) = false potentially_self_aliased(A::StridedArray) = any(==(0), strides(A)) -potentially_self_aliased(A::SubArray) = any(!allunique, A.indices) +potentially_self_aliased(A::SubArray) = any(map(!allunique, A.indices)) potentially_self_aliased(A::Union{Base.ReshapedArray,Base.ReinterpretArray}) = potentially_self_aliased(A.parent) -potentially_self_aliased(::Any) = true +potentially_self_aliased(::Any) = false # Preprocessing a `Broadcasted` does two things: # * unaliases any arguments from `dest`