[PATCH] D118317: [InstCombine] Fold and-reduce idiom

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 27 05:24:40 PST 2022


mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:5885
 
+/// This function folds patterns produced by lowering of redice idioms, such as
+/// llvm.vector.reduce.and which are lowered into instruction chains. This code
----------------
lebedev.ri wrote:
> 
Ahaha, good catch! :)


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:5907
+        OpTy->getNumElements() * LHSTy->getElementType()->getIntegerBitWidth();
+    if (DL.isLegalInteger(NumBits)) {
+      auto *ScalarTy = Builder.getIntNTy(NumBits);
----------------
lebedev.ri wrote:
> mkazantsev wrote:
> > lebedev.ri wrote:
> > > I suspect this should be relaxed to something like "is less than a legal integer"
> > I'm not sure what happens if smth like `i63` lives through the pipeline to codegen. Is it ok?
> Not sure, but at least something like "is a power of two that is smaller than the largest legal integer" should be fine.
I didn't find good API to get this largest legal integer. Let's postpone.


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

https://reviews.llvm.org/D118317



More information about the llvm-commits mailing list