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

2018-05-22 Thread Sanjay Patel via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC333038: [CodeGen] use nsw negation for builtin abs (authored by spatel, committed by ). Repository: rC Clang https://reviews.llvm.org/D47202 Files: lib/CodeGen/CGBuiltin.cpp test/CodeGen/builtin-a

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

2018-05-22 Thread Sanjay Patel via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL333038: [CodeGen] use nsw negation for builtin abs (authored by spatel, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D47202?vs=148020&id=148

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

2018-05-22 Thread Craig Topper via Phabricator via cfe-commits
craig.topper accepted this revision. craig.topper added a comment. This revision is now accepted and ready to land. This seems right to me. GCC believes believes that __bultin_abs always returns a positive number. https://reviews.llvm.org/D47202 __

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

2018-05-22 Thread Sanjay Patel via Phabricator via cfe-commits
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 curren

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

2018-05-22 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. 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 :) https://review

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

2018-05-22 Thread Sanjay Patel via Phabricator via cfe-commits
spatel created this revision. spatel added reviewers: craig.topper, efriedma, lebedev.ri. Herald added a subscriber: mcrosier. The clang builtins have the same semantics as the stdlib functions. The stdlib functions are defined in section 7.20.6.1 of the C standard with: "If the result cannot be