Re:Impact of Undefined Behavior on Performance
by kzrdude on Friday July 09, 2021 @06:52AM
(#27782373)
When you write it like that, it sounds insane. But it's very far from how compilers work. There is nothing like "find UB, then take advantage of it", it's completely inverted.
The normal rules the optimizer works from assume there is no UB. It's just always the normal rules, and they work the same way for all programs.
MichaelBurge's comment has illustrated this better than I could.
The normal rules the optimizer works from assume there is no UB. It's just always the normal rules, and they work the same way for all programs.
MichaelBurge's comment has illustrated this better than I could.