[PATCH] D73214: [MIPS GlobalISel] Select count leading zeros

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 05:08:48 PST 2020


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:980
   case TargetOpcode::G_CTPOP:
-    if (TypeIdx != 0)
-      return UnableToLegalize; // TODO
+    if (TypeIdx == 1)
+      switch (MI.getOpcode()) {
----------------
atanasyan wrote:
> arsenm wrote:
> > atanasyan wrote:
> > > Is it possible that `TypeIdx != 0 && TypeIdx != 1` ?
> > That would be an invalid case as these instructions only have 2 type indexes
> Yeah, I understand that this case is invalid. Does it make a sense to note this fact and add some sort of assert?
I think it's kind of a waste of time, and the we inconsistently assert or not on these. It should be possible to write a generic assert that catches invalid type indices for every instruction so every helper doesn't need to worry about it


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

https://reviews.llvm.org/D73214





More information about the llvm-commits mailing list