blob: aba951acdd08d7d079afa4c0f6edffa26e497fcf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
// ignore-debug: standard library debug assertions add a panic that breaks this optimization
#![crate_type = "lib"]
pub fn variant_a(input: &[(usize, usize, usize, usize)]) -> usize {
input.iter().filter(|(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count()
}
pub fn variant_b(input: &[(usize, usize, usize, usize)]) -> usize {
input.iter().filter(|&&(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count()
}
// EMIT_MIR slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
// EMIT_MIR slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
|