[PATCH] D132412: [InstCombine] reassociate/factor add+mul with common operand
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 22 14:32:35 PDT 2022
spatel created this revision.
spatel added reviewers: craig.topper, hiraditya, Allen.
Herald added subscribers: StephenFan, wenlei, mcrosier.
Herald added a project: All.
spatel requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
(X * Y) + (X + Z) --> ((Y + 1) * X) + Z
https://alive2.llvm.org/ce/z/CvBvyz
This is one of the IR transforms suggested in issue #57255 <https://github.com/llvm/llvm-project/issues/57255>.
In examples like the motivating report with a constant operand, we eliminate an instruction, but this should be better in IR even with all variables because it removes a use of a variable operand. The backend should be able to re-distribute the multiply if that's better for the target.
https://reviews.llvm.org/D132412
Files:
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
llvm/test/Transforms/InstCombine/add.ll
llvm/test/Transforms/PGOProfile/chr.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132412.454611.patch
Type: text/x-patch
Size: 7399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220822/91823632/attachment.bin>
More information about the llvm-commits
mailing list