[PATCH] D140666: [InstCombine] combine intersection for inequality icmps

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 23:45:21 PST 2023


bcl5980 added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:628
 
   if (Mask & BMask_Mixed) {
     // (icmp eq (A & B), C) & (icmp eq (A & D), E)
----------------
Can we merge the code into here? It looks the logic is almost the same.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:681-682
+
+    assert((~*ConstB & ConstC) == 0);
+    assert((~*ConstD & ConstE) == 0);
+
----------------
spatel wrote:
> Add a string message to each assert like "Expected impossible compares to be simplified".
> 
> But I'm skeptical that we can actually do that. Ie, how do we guarantee that the operands of this logic instruction were already visited before we got here? If we can't guarantee that, just bail out instead.
I think the assert should be OK. simplifyICmpInst will optimize the icmp to constant at very early time before the assert triggered.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140666



More information about the llvm-commits mailing list