[libc-commits] [PATCH] D131095: [libc] Prevent overflow from intermediate results when adding UInt<N> values.

Kirill Okhotnikov via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Aug 4 07:52:08 PDT 2022


orex added a comment.

In D131095#3699654 <https://reviews.llvm.org/D131095#3699654>, @tschuett wrote:

> Did you consider using builtins with overflow checking:
> https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html
> It is platform independent and leaves some optimisations opportunities to the compiler.

In general this is a good idea, but it can be two problems:

1. It still can setup flags, which should be avoided.
2. I'm worried is it still exists on this stage. I had a problem, that some builtins were not exists. See https://github.com/llvm/llvm-project/commit/27aca975b6b6e9d5c7516c091f954884b28650ae for example.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131095/new/

https://reviews.llvm.org/D131095



More information about the libc-commits mailing list