@@ -177,25 +177,24 @@ begin
177
177
end
178
178
179
179
# 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
184
182
185
183
callee_mi = Base. method_instance (deduped_callee, (Int,))
186
184
187
185
# 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
190
187
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
191
191
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))
194
193
N′ = length (callee_mi. backedges)
195
194
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
199
198
end
200
199
end
201
200
0 commit comments