Skip to content

Commit 1bebdcc

Browse files
committed
chore: filter out same block loop breakers like normal
1 parent 2bf0ef5 commit 1bebdcc

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • libs/@local/hashql/mir/src/pass/transform/inline

libs/@local/hashql/mir/src/pass/transform/inline/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,15 @@ impl<'heap, A: Allocator> InlineState<'_, '_, '_, 'heap, A> {
225225
/// Used for filter functions which bypass normal heuristics.
226226
/// Self-calls are excluded to prevent panics in `get_disjoint_mut`.
227227
fn collect_all_callsites(&self, body: DefId, mem: &mut InlineStateMemory<A>) {
228+
let component = self.components.scc(body);
229+
228230
self.graph
229231
.apply_callsites(body)
230-
.filter(|callsite| callsite.target != body)
232+
.filter(|callsite| {
233+
callsite.target != body
234+
&& (self.components.scc(callsite.target) != component
235+
|| !self.loop_breakers.contains(callsite.target))
236+
})
231237
.collect_into(&mut mem.callsites);
232238
}
233239

@@ -261,7 +267,7 @@ impl<'heap, A: Allocator> InlineState<'_, '_, '_, 'heap, A> {
261267
// Within an SCC, only skip calls to loop breakers (they break the cycle).
262268
// Calls to non-breakers within the SCC are eligible because we're now inside of a DAG.
263269
let same_scc = self.components.scc(callsite.target) == component;
264-
if same_scc && (self.loop_breakers.contains(callsite.target)) {
270+
if same_scc && self.loop_breakers.contains(callsite.target) {
265271
continue;
266272
}
267273
if callsite.target == body {

0 commit comments

Comments
 (0)