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

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 9 02:02:04 PST 2020


foad accepted this revision.
foad added a comment.
This revision is now accepted and ready to land.

LGTM modulo minor comments inline.



================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:432
   /// success.
-  bool matchAndWithTrivialMask(MachineInstr &MI, Register &Replacement);
+  bool matchAndWithRedundantMask(MachineInstr &MI, Register &Replacement);
 
----------------
Maybe just `matchRedundantAnd`?


================
Comment at: llvm/include/llvm/Target/GlobalISel/Combine.td:385
 // Fold (x & mask) -> x when (x & mask) is known to equal x.
-def and_trivial_mask_matchinfo : GIDefMatchData<"Register">;
-def and_trivial_mask: GICombineRule <
-  (defs root:$root, and_trivial_mask_matchinfo:$matchinfo),
+def and_redundant_mask_matchinfo : GIDefMatchData<"Register">;
+def and_redundant_mask: GICombineRule <
----------------
I think we should define a standard Register matchdata that we can use here and elsewhere. Doesn't have to be part of this patch though.


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

https://reviews.llvm.org/D90674



More information about the llvm-commits mailing list