Skip to content

Commit 7525568

Browse files
committed
Update back-edge de-duplication test
1 parent bf725f1 commit 7525568

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

Compiler/test/invalidation.jl

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,25 +177,24 @@ begin
177177
end
178178

179179
# Verify that adding the backedge again does not actually add a new backedge
180-
let mi1 = Base.method_instance(deduped_caller1, (Int,)),
181-
mi2 = Base.method_instance(deduped_caller2, (Int,)),
182-
ci1 = mi1.cache
183-
ci2 = mi2.cache
180+
let mi = Base.method_instance(deduped_caller1, (Int,)),
181+
ci = mi.cache
184182

185183
callee_mi = Base.method_instance(deduped_callee, (Int,))
186184

187185
# Inference should have added the callers to the callee's backedges
188-
@test ci1 in callee_mi.backedges
189-
@test ci2 in callee_mi.backedges
186+
@test ci in callee_mi.backedges
190187

188+
# In practice, inference will never end up calling `store_backedges`
189+
# twice on the same CodeInstance like this - we only need to check
190+
# that de-duplication works for a single invocation
191191
N = length(callee_mi.backedges)
192-
Core.Compiler.store_backedges(ci1, Core.svec(callee_mi))
193-
Core.Compiler.store_backedges(ci2, Core.svec(callee_mi))
192+
Core.Compiler.store_backedges(ci, Core.svec(callee_mi, callee_mi))
194193
N′ = length(callee_mi.backedges)
195194

196-
# The number of backedges should not be affected by an additional store,
197-
# since de-duplication should have noticed the edge is already tracked
198-
@test N == N′
195+
# A single `store_backedges` invocation should de-duplicate any of the
196+
# edges it is adding.
197+
@test N- N == 1
199198
end
200199
end
201200

0 commit comments

Comments
 (0)