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

Shivam Gupta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 20:40:02 PDT 2023


xgupta 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) &&
----------------
xgupta wrote:
> goldstein.w.n wrote:
> > xgupta wrote:
> > > goldstein.w.n wrote:
> > > > Is there why this patch adds this new functionality and doesn't juist update `foldLogOpOfMaskedICmps` to handle undefs? Is it alot of work?
> > > I have not thought about that, I will try to explore that. 
> > > I wrote this as similar to a few line above for  (icmp eq A, 0) & (icmp eq B, 0) --> (icmp eq (A|B), 0)"
> > well I'm just wondering what the todo is about.
> OK, seems @nikic added that TODO in https://github.com/llvm/llvm-project/commit/84e273cced851075df46c78362ad3507a4de61d0.
@nikic shall we keep TODO or remove it or do you have any suggestion how to make foldLogOpOfMaskedICmps handle undefs.


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