https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78713
--- Comment #7 from Avi Kivity <avi at scylladb dot com> --- That's because std::optional was optimized. A hand-rolled version is still bad. https://godbolt.org/z/Ma48hjE44 I think the middle-end would benefit from clobbers and some logic to eliminate those branches.
