3 ms·
The dependency could be arbitrarily many millions of instructions away. The only way to know there isn't a dependency is if that register gets clobbered by som
by brucehoult 6y ago
The dependency could be arbitrarily many millions of instructions away.
The only way to know there isn't a dependency is if that register gets clobbered by something else very soon afterwards.
But this whole topic of "checking for signed overflow is expensive" is overblown. It's simply not that important an operation, especially in the context of those languages that do it a lot also doing a lot of memory references, which are far more expensive.
Adding arbitrary completely unknown integers is pretty rare. If you know both numbers are greater than zero then a single compare-and-branch is all you need. If one of the numbers is a constant then a single compare-and-branch is all you need.