[PATCH] D60460: [SelectionDAG] Let computeKnownBits handle OR-like ADDs better

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 01:21:45 PDT 2019


bjope added a comment.

In D60460#1460387 <https://reviews.llvm.org/D60460#1460387>, @lebedev.ri wrote:

> In D60460#1460375 <https://reviews.llvm.org/D60460#1460375>, @nikic wrote:
>
> > We have an accurate known bits implementation for adds in `KnownBits::computeForAddSub()`, which should handle this and more automatically. We use it to compute add known bits in IR. Is there a reason why it's not used for SDAG known bits?
>
>
> Hmm, good point. In general because of IR `Value` vs DAG `SDValue`. But clearly that function should work here..


Ahh, great! Using `KnownBits::computeForAddSub()` sounds like the right thing to do. I'll give it a try!

And then I guess we should do the same for SUB. I need to figure out if the `computeForAddSub` cover the special cases handled by SelectionDAG for SUB. I might skip doing anything about SUB in this patch if it turns out to be non-trivial to simply replace the current logic with a call to `computeForAddSub`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60460





More information about the llvm-commits mailing list