Overflow intrinsics

Hello-

Over the past couple of days I've been writing some very basic optimisations in -instcombine for the arithmetic with overflow intrinsics. As Duncan Sands pointed out on IRC however, this is duplicated effort when one can get equivalent results using weird sizes of ints in the IR.

At present (at least, on x86/x86-64), the overflow intrinsics generate better code. So what would be the better route: keeping the overflow intrinsics, or getting rid of them and improving codegen to handle flags better?

Alastair

Hi,

At present (at least, on x86/x86-64), the overflow intrinsics generate better code. So what would be the better route: keeping the overflow intrinsics, or getting rid of them and improving codegen to handle flags better?

http://llvm.org/bugs/show_bug.cgi?id=5443

Ciao,

Duncan.

Both. Until codegen improves to the point where it is always better or equal to the intrinsics, we should keep the intrinsics and keep improving codegen. If they ever become "always better than" the intrinsics, we can remove the intrinsics. We're a long way away from being able to remove them, but I agree in principle that it would be nice to eliminate them.

-Chris