[llvm-dev] Dynamic detection of signed integer overflow

Pflanzer, Moritz via llvm-dev llvm-dev at lists.llvm.org
Sun Sep 13 04:03:38 PDT 2015


Hello,

I thought about doing a dynamic detection of signed integer overflow for OpenCL kernels based on the generated LLVM IR.

A problem seems to be that the LLVM IR does not differentiate between signed and unsigned types in general. But for instance for additions it should be possible to use the "nsw" flag as indicator that the operations involves signed types. Is this a legal assumption so far?
The next problem I discovered is that the "nsw" flag is not generated for additions involving vector types (http://lists.llvm.org/pipermail/cfe-dev/2011-May/014908.html).

Is there any other method how I could get information only from the LLVM IR about whether signed types are involved in arithmetic operations? Or do you know any other project with the same or a similar goal of dynamic detection of signed integer overflow (for OpenCL)?

Regards,

Moritz


More information about the llvm-dev mailing list