[PATCH] D109217: [NOT FOR COMMIT] [llvm-dwarfdump] Fix unsigned overflow when calculating stats
Thorsten via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 6 12:59:06 PDT 2021
tschuett added a comment.
In D109217#2985644 <https://reviews.llvm.org/D109217#2985644>, @dblaikie wrote:
> In D109217#2984816 <https://reviews.llvm.org/D109217#2984816>, @tschuett wrote:
>
>> Could something ala:
>> https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html
>> help?
>
> Probably enough to write the portable code (so it works on MSVC too, etc) and let the compiler optimize it. At least for this saturation code, Clang produces the same with or without the intrinsic (& GCC produces something else entirely - to itself and to clang): https://godbolt.org/z/jb3nnaKvT
Maybe LLVM should learn saturating integers that assert in debug mode?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109217/new/
https://reviews.llvm.org/D109217
More information about the llvm-commits
mailing list