[PATCH] D108049: [InstCombine] Canonicalize saturate with shift and xor to min/max clamp

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 31 10:27:45 PDT 2021


lebedev.ri added a comment.

The problem with smaller intermediate folds is that the larger final fold
may still be wanted iff the intermediate folds may be blocked due to the use counts..



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:865-866
+  Type *Ty = I.getType();
+  if (!Ty->isIntOrIntVectorTy() || !isPowerOf2_32(Ty->getScalarSizeInBits()))
+    return nullptr;
+  unsigned BW = Ty->getScalarSizeInBits();
----------------
I'm not sure bitwidth cutoff should be here?
It should be easy to legalize in backend, in fact it already has to.


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

https://reviews.llvm.org/D108049



More information about the llvm-commits mailing list