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

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 18:43:48 PST 2023


bcl5980 added a comment.

In D142803#4106685 <https://reviews.llvm.org/D142803#4106685>, @spatel wrote:

> In D142803#4105675 <https://reviews.llvm.org/D142803#4105675>, @bcl5980 wrote:
>
>> Ping.
>> Anyone can help to review it? Or is this necessary for llvm? 
>> I try to run it on test-suite, it looks only spec2017 502.gcc can trigger this 6 times.
>
> It seems like a nice improvement. It would be great if it eventually allows removing some of the pattern-specific complex logic reductions that we have in InstCombine/InstSimplify:
> https://github.com/llvm/llvm-project/blob/b5ee4f755fcff56243f6ff0cea9e7a722259304a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp#L1719

The initial patch can't replace the code in `foldComplexAndOrPatterns`. I will continue work on it that maybe one day we can replace all patterns in `foldComplexAndOrPatterns`.
For now, this code only enabled on `O3`, but the `foldComplexAndOrPatterns` may work on `O2` also. I'm not sure the CPU overhead for this patch. If later we can proof this is not a big overhead we can move it to Instcombine.

> I had not seen "boolean ring" before this. Do you know if that is implemented in any other programs/compilers?

I'm sorry I am a beginner on compiler, the only compiler I touch is Clang/LLVM. So I don't know if any other programs/compiler have similar code or not. This patch is written based on my understand of boolean ring.


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

https://reviews.llvm.org/D142803



More information about the llvm-commits mailing list