Skip to content

Commit 3ea8695

Browse files
committed
Update
1 parent ec6b333 commit 3ea8695

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

test/rewrite_generic.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,20 +480,18 @@ function test_allocations_rewrite_unary_minus()
480480
MA.@rewrite(-sum(x[i] for i in 1:N), move_factors_into_sums = false)
481481
MA.@rewrite(sum(a * x[i] for i in 1:N), move_factors_into_sums = false)
482482
sum(-x[i] for i in 1:N)
483-
total = @allocated sum(-x[i] for i in 1:N)
484-
# actual
485483
value = @allocated(
486484
MA.@rewrite(sum(-x[i] for i in 1:N), move_factors_into_sums = false),
487485
)
488-
@test value < total
486+
@test value < @allocated sum(-x[i] for i in 1:N)
489487
value = @allocated(
490488
MA.@rewrite(-sum(x[i] for i in 1:N), move_factors_into_sums = false),
491489
)
492-
@test value < total
490+
@test value < @allocated -sum(x[i] for i in 1:N)
493491
value = @allocated(
494492
MA.@rewrite(sum(a * x[i] for i in 1:N), move_factors_into_sums = false),
495493
)
496-
@test value < total
494+
@test value < @allocated sum(a * x[i] for i in 1:N)
497495
return
498496
end
499497

test/utilities.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ include("dummy.jl")
1010
# v1.12.5 off by 8
1111
_big_int_alloc() = @allocated(BigInt(1))
1212

13-
function alloc_test(f, expected_upper_bound)
13+
function alloc_test(f::F, expected_upper_bound::Int) where {F<:Function}
1414
f() # compile
1515
measured_allocations = @allocated f()
1616
@test measured_allocations <= expected_upper_bound

0 commit comments

Comments
 (0)