[PATCH] D85463: [GlobalISel] Add combine for (x & mask) -> x when (x & mask) == x

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 13:57:19 PDT 2020


paquette added a subscriber: dsanders.
paquette added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:1807
+  assert(MI.getOpcode() == TargetOpcode::G_AND);
+  if (!KB)
+    return false;
----------------
arsenm wrote:
> I would kind of expect combines to be marked with requiring this, and the generated matcher table would understand to skip this if known bits isn't available
Yeah, that would make sense.

@dsanders, is there any way to do this in the combiner right now?


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:1815
+  LLT DstTy = MRI.getType(AndDst);
+  if (DstTy.isVector())
+    return false;
----------------
arsenm wrote:
> I don't see why vectors wouldn't work
Don't think there's any way to really test it right now because it looks like GISelKnownBits doesn't support vectors yet.


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

https://reviews.llvm.org/D85463



More information about the llvm-commits mailing list