[PATCH] D76500: GlobalISel: Lower funnel shifts

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 22 13:32:52 PDT 2021


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:4975
+        const ConstantInt *C = getConstantIntVRegVal(R, MRI);
+        return !C || C->getValue().urem(BW) != 0;
+      },
----------------
arsenm wrote:
> foad wrote:
> > foad wrote:
> > > Should be `C && C->getValue().urem(BW) != 0`.
> > I still think this check for `!C` is either wrong or redundant, depending on what the behaviour of matchUnaryPredicate is supposed to be.
> This is is correct because in the variable case, you have to assume it's a non-zero mod
Huh? In the variable case you can't assume it's a non-zero mod, because it might not be. This function is really is**Known**ToBeNonZeroModBitWidthOrUndef, and the safe default is to return false.


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

https://reviews.llvm.org/D76500



More information about the llvm-commits mailing list