I see 2 conditional jumps (ja
, jump if above) to .LBB3_3
and .LBB3_4
and they call slice_index_order_fail
and slice_end_index_len_fail
respectively. Those calls are followed by ud2
, which is the same instruction emitted by unreachable_unchecked
, i.e. the program must either throw an exception (panic; inside the called functions) or abort. In conclusion, the call to unwrap
hasn't been removed, but inlined. That's an important difference.
A never-inlined function can never be optimized in the way you want it to, because you explicitly tell the compiler to not look outside the function to optimize what's inside function¹.
¹ Except maybe for profile-guided optimization, which I'm unfamiliar with, but that wouldn't change the function semantically, IIRC.