2 ms·
> if every operation is checked for overflow, there's much less scope for reordering/collapsing/vectorising operations Lets pretend that instead of "put a cond
by ufo 12y ago
> if every operation is checked for overflow, there's much less scope for reordering/collapsing/vectorising operations
Lets pretend that instead of "put a conditional jump after every operation", we try to model things as "pretend all integers are infinite precision, blow up if overflow happens at some point". So for example, we would be OK with rewriting
int x = MAX_INT
int y = (x + 1) - 1 //overflow - BOOM!
with
int x = MAX_INT
int y = x; //no overflow
Yes, this means that the program does different things depending on the level of optimization but are there any reordering/vectorizing possibilities that get blocked now?