It&#x27;s not really about optimisations, but more about being able to translate directly to fast machine instructions (which may behave differently on different machines). What I&#x27;m talking about is not adding checks, but what happens when the compiler knows that something has undefined behavior through e.g. Constant propagation. This happens in the optimizer on IR level. The undefined behaviour is there to make translations to machine instructions efficient - so that you don&#x27;t need to do checks on pointers and that addition, shift, etc. on several instructions are supported although they behave slightly differently