[PATCH] D148440: [InstCombine] Fold zext(shl(trunc)) into and(shl)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 17 10:16:22 PDT 2023


RKSimon added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:1214
+  const APInt *C1;
+  if (match(Src, m_Shl(m_Trunc(m_Value(X)), m_APInt(C1))) &&
+      X->getType() == DestTy) {
----------------
goldstein.w.n wrote:
> Why only `shl`, this seems to be pretty generically true:
> https://alive2.llvm.org/ce/z/kTBKC7
Also, why just APInt? We should be able to perform this for any Constant (and just create the Mask below generically with Builder).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148440



More information about the llvm-commits mailing list