I'm doing a bit of a crazy project where I compile an IR to
'Clang-flavored C99'. The IR guarantees sane overflow/underflow
semantics for signed arithmetic, but as far as I can tell, Clang
doesn't (which is in line with the standard). Does Clang provide any
intrinsics to achieve this, which the optimizers in LLVM will respect?
-fwrapv should permit signed overflow as well, just like in GCC. Not sure if we pass this flag all the way down, but a quick look at CodeGen does look like we're using the same Add as unsigned integers when -fwrapv is passed.