[PATCH] D47202: [CodeGen] use nsw negation for abs

Sanjay Patel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 22 09:37:32 PDT 2018


spatel added a comment.

In https://reviews.llvm.org/D47202#1108016, @lebedev.ri wrote:

> That is what happens for "hand-rolled" `abs`, https://godbolt.org/g/6dbgXD
>  I *think* this makes sense, since **IIRC** LLVM only supports twos-complement platforms.
>  But all these attributes are currently beyond me, so i won't click the accept button :)


Thanks for taking a look! I should also note that we don't translate the standard libcall to the builtin in clang (not sure if we should), so this patch doesn't currently affect the common case. We'd probably want to do something similar in LibCallSimplifier if this is right.


https://reviews.llvm.org/D47202





More information about the cfe-commits mailing list