[PATCH] D151660: [InstCombine] (icmp eq A, -1) & (icmp eq B, -1) --> (icmp eq (A&B), -1)

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 09:58:07 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2952
+  // (icmp eq A, -1) & (icmp eq B, -1) --> (icmp eq (A&B), -1)
+  // TODO: Remove this when foldLogOpOfMaskedICmps can handle undefs.
+  if (!IsLogical && PredL == (IsAnd ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE) &&
----------------
Is there why this patch adds this new functionality and doesn't juist update `foldLogOpOfMaskedICmps` to handle undefs? Is it alot of work?


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2958
+    return Builder.CreateICmp(PredL, NewAnd,
+                              ConstantInt::get(LHS0->getType(), -1));
+  }
----------------
`ConstantInt::get(LHS0->getType(), -1)` -> `Constant::getAllOnesValue(LHS0->getType())`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151660



More information about the llvm-commits mailing list