[PATCH] D104193: [InstCombine] Fold (sext bool X) * (sext bool X) to zext (and X, X)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 15 02:17:39 PDT 2021


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

Seems fine to me. Please precommit the tests before committing this.
Thanks.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:331
       X->getType()->isIntOrIntVectorTy(1) && X->getType() == Y->getType() &&
-      (Op0->hasOneUse() || Op1->hasOneUse())) {
+      (Op0->hasOneUse() || Op1->hasOneUse() || X == Y)) {
     Value *And = Builder.CreateAnd(X, Y, "mulbool");
----------------
Equality check is faster, it should go first.


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

https://reviews.llvm.org/D104193



More information about the llvm-commits mailing list