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

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 08:40:13 PDT 2023


goldstein.w.n 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);
----------------
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.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:929
+              return I;
+            }
+          } else {
----------------
Do we need to cleanup the constants if we don't actually insert them?


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