Skip to content

Commit

Permalink
More inlining prevention
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Jul 7, 2017
1 parent 4564726 commit 705a187
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion base/abstractarraymath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ _rshps(shp, shp_i, sz, i, ::Tuple{}) =
_reperr(s, n, N) = throw(ArgumentError("number of " * s * " repetitions " *
"($n) cannot be less than number of dimensions of input ($N)"))

@propagate_inbounds function _repeat(A::AbstractArray, inner, outer)
@noinline function _repeat(A::AbstractArray, inner, outer)
shape, inner_shape = rep_shapes(A, inner, outer)

R = similar(A, shape)
Expand Down
7 changes: 5 additions & 2 deletions base/reduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ r_promote(op, x::T) where {T} = convert(r_promote_type(op, T), x)

## foldl && mapfoldl

function mapfoldl_impl(f, op, v0, itr, i)
@noinline function mapfoldl_impl(f, op, v0, itr, i)
# Unroll the while loop once; if v0 is known, the call to op may
# be evaluated at compile time
if done(itr, i)
Expand Down Expand Up @@ -174,7 +174,7 @@ foldr(op, itr) = mapfoldr(identity, op, itr)

# This is a generic implementation of `mapreduce_impl()`,
# certain `op` (e.g. `min` and `max`) may have their own specialized versions.
function mapreduce_impl(f, op, A::AbstractArray, ifirst::Integer, ilast::Integer, blksize::Int=pairwise_blocksize(f, op))
@noinline function mapreduce_impl(f, op, A::AbstractArray, ifirst::Integer, ilast::Integer, blksize::Int)
if ifirst == ilast
@inbounds a1 = A[ifirst]
return r_promote(op, f(a1))
Expand All @@ -197,6 +197,9 @@ function mapreduce_impl(f, op, A::AbstractArray, ifirst::Integer, ilast::Integer
end
end

mapreduce_impl(f, op, A::AbstractArray, ifirst::Integer, ilast::Integer) =
mapreduce_impl(f, op, A, ifirst, ilast, pairwise_blocksize(f, op))

"""
mapreduce(f, op, itr)
Expand Down
2 changes: 1 addition & 1 deletion base/sparse/sparsematrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ position forward in `X.colptr`, computes `map(f, transpose(A[:,q]))` by appropri
distributing `A.rowval` and `f`-transformed `A.nzval` into `X.rowval` and `X.nzval`
respectively. Simultaneously fixes the one-position-forward shift in `X.colptr`.
"""
function _distributevals_halfperm!(X::SparseMatrixCSC{Tv,Ti},
@noinline function _distributevals_halfperm!(X::SparseMatrixCSC{Tv,Ti},
A::SparseMatrixCSC{Tv,Ti}, q::AbstractVector{<:Integer}, f::Function) where {Tv,Ti}
@inbounds for Xi in 1:A.n
Aj = q[Xi]
Expand Down

0 comments on commit 705a187

Please sign in to comment.