Skip to content

Commit bfbe243

Browse files
@facebook-github-bot
authored andcommitted
Change the if condition to assertion in fixpoint iterator in run function
Summary: Just found that when checking the component index is not entry, we used if check in the Rust version, while an assertion should be better as that condition should never be true (outer predecessor is impossible to be entry node). And this is what the C++ version does. Reviewed By: yuxuanchen1997 Differential Revision: D40204333 fbshipit-source-id: 00c8b461ebcf63565fd8dc0e5c47001d048378cf
1 parent 74b4804 commit bfbe243

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

rust/src/fixpoint_iter.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,11 @@ where
177177
Self::extrapolate(&context, head, current_state, new_state);
178178
context.increase_iteration_count_for(head);
179179
for (&component_idx, &num) in self.wpo.get_num_outer_preds(wpo_idx) {
180-
if component_idx != entry_idx {
181-
let old_counter =
182-
wpo_counter[component_idx as usize].fetch_add(num, Ordering::Relaxed);
183-
if old_counter + num == self.wpo.get_num_preds(component_idx) {
184-
worklist.push_back(component_idx);
185-
}
180+
assert!(component_idx != entry_idx);
181+
let old_counter =
182+
wpo_counter[component_idx as usize].fetch_add(num, Ordering::Relaxed);
183+
if old_counter + num == self.wpo.get_num_preds(component_idx) {
184+
worklist.push_back(component_idx);
186185
}
187186
}
188187

0 commit comments

Comments
 (0)