[PATCH] D155307: [InstCombine] Allow KnownBits to be propagated

Paulo Matos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 08:55:06 PDT 2023


pmatos marked an inline comment as done.
pmatos added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:924
+          LHSKnown = computeKnownBits(I->getOperand(0), Depth + 1, I);
           if (DemandedMaskLHS.isSubsetOf(LHSKnown.Zero | LHSKnown.One)) {
+            Constant *NewLHS = Constant::getIntegerValue(VTy, LHSKnown.One);
----------------
goldstein.w.n wrote:
> Maybe cleaner is `if (DemandedMaskLHS.isSubsetOf(LHSKnown.Zero | LHSKnown.One) && !match(I->getOperand(0), m_SpecificInt(LHSKnown.Zero | LHSKnown.One))`
> 
> Then you can just keep the original code in the if statement.
Thanks - didn't know about m_SpecificInt. But I guess you mean:  

```
DemandedMaskLHS.isSubsetOf(LHSKnown.Zero | LHSKnown.One) &&
              !match(I->getOperand(0), m_SpecificInt(LHSKnown.One)
```

right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155307



More information about the llvm-commits mailing list