[PATCH] D87464: [TargetLowering] Improve SimplifyDemandedBits for AND and OR

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 07:07:52 PDT 2020


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1271
+    // known bits in Op0, try simplifying Op1 again.
+    APInt Op1DemandedBits = ~Known2.One & DemandedBits;
+    if (Op1DemandedBits != DemandedBits &&
----------------
craig.topper wrote:
> Can we trust Known2.One's value is correct for the bits that weren't checked due to Known.One being used to filter the DemandedBits for the previous call?
No we can't according to the comment on SimplifyDemandedBits:
```
  /// expression (used to simplify the caller).  The KnownZero/One bits may only
  /// be accurate for those bits in the Demanded masks.
```
This was a pre-existing problem with the call on line 1264.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87464



More information about the llvm-commits mailing list