This is the sort of emotionally-charged fearmongering around UB that really makes any discussion pointless. That example is wrong. Integers can be signed. If a compiler cannot prove x >= 0, then it simply cannot remove that code.
Now, if you used
unsigned int x = whatever;
...
if(x < 0)
There would be an obvious case for removing that if.