[PATCH] D74060: [KnownBits] Move AND, OR and XOR logic into KnownBits

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 5 09:09:25 PST 2020


foad marked an inline comment as done.
foad added a comment.

> I'm not sure about this since the logic isn't completely obvious. What about KnowBits::computeForAND/computeForOR/computeForXOR helpers instead?

I think that's a matter of taste. Personally I find "computeForXXX" unnecessarily verbose in these simple cases. Also note that clients use both plain & and &= (and | and |= and ^ and ^=) and it's nice to have efficient move semantics in all cases. It seems to me that operator overloading provides the perfect framework for doing all of that.

On the other hand, thinking ahead a bit: add/subtract/multiply will still require a named method because they will take additional arguments like nsw and nuw. Shifts might require named methods so that we can reasonably distinguish signed from unsigned right shifts.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74060





More information about the llvm-commits mailing list