[PATCH] D125198: [InstCombine] ((A + B) + C) + A --> (A << 1) + (B + C)
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 9 04:44:23 PDT 2022
spatel added a comment.
In D125198#3500072 <https://reviews.llvm.org/D125198#3500072>, @Chenbing.Zheng wrote:
> In D125198#3499998 <https://reviews.llvm.org/D125198#3499998>, @RKSimon wrote:
>
>> What's the motiviation for this patch? I notice we already get the shift+add pattern: https://clang.godbolt.org/z/58c6e9jbj
>
> I just notice the 'todo' left in add.ll. According to what you describe, we already have pattern to implement it, so I will abandant this patch.
This is another example where `-reassociate` can handle the problem more generally. It recognizes the common operand and forms a multiply. If we do not have a real benchmark or application that shows a problem for this kind of pattern, then it would be fine to replace that "TODO" comment with an explanation like:
; "-reassociate" can optimize this even if "-instcombine" does not.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125198/new/
https://reviews.llvm.org/D125198
More information about the llvm-commits
mailing list