[PATCH] D142803: [LogicCombine 1/?] Implement a general way to simplify logical operations.

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 22:28:29 PST 2023


bcl5980 added a comment.

In D142803#4156027 <https://reviews.llvm.org/D142803#4156027>, @aeubanks wrote:

> with this patch, would it possible to remove some similar optimizations from instcombine, those being subsumed by this?

This patch can't replace the normal patterns in instcombine. Because this patch works bad between logical node itself. For example,

  define i8 @test(i8 %a, i8 %b, i8 %c, i8 %d) {
     %oab = or i8 %a, %b
     %ocd = or i8 %c, %d
     %and = and i8 %oab, %ocd
     %r = and i8 %and, %and
     ret i8 %r
  }

Obviously the %r is the same to %and. But both of them in the logical node is a complicated set of bitsets. For now it's not easy to find %and is the same to %r.


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

https://reviews.llvm.org/D142803



More information about the llvm-commits mailing list