[PATCH] D60460: [SelectionDAG] Use KnownBits::computeForAddSub in SelectionDAG::computeKnownBits

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 02:56:50 PDT 2019


nikic added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2948
         Known.Zero.setBits(1, KnownZeroLow);
       break;
     }
----------------
I think it would make more sense to move the computeForAddSub calculation above this branch, and then do something like this here:

```
// With ADDE and ADDCARRY a carry bit may be added, so we can only use
// this information if we know that the low bit is clear.
if (!lowBitSet(Known.Zero)) { // How do you write this operation with APInt?
  Known.One.clearAllBits();
  Known.Zero.clearAllBits();
  break;
}

Known.Zero.clearBit(0);
```

This allows us to use the full known bits result, just without the low bit, if it is possible.


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