[PATCH] D59442: Enable Operand Reordering for Commutative Instructions in the FunctionComparator/MergeFunctions
Rodrigo Caetano Rocha via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 15 17:11:47 PDT 2019
rcorcs created this revision.
rcorcs added reviewers: jfb, davide.
Herald added subscribers: llvm-commits, jdoerfert.
Herald added a project: LLVM.
The function merger should be able to handle small differences if the two functions are still equivalent.
This patch, as the title suggests, enables the function merger to handle simple operand reordering for commutative binary operators.
For example:
mul nsw i32 3, %a
should be equivalent to
mul nsw i32 %a, 3
This check is handled by the FunctionComparator. Whenever it says that two functions are equivalent, the MergeFunctions pass is able to merge them.
I've added a simple unit test to exercise this change. All unit tests pass as expected.
- Rodrigo Rocha
Repository:
rL LLVM
https://reviews.llvm.org/D59442
Files:
lib/Transforms/Utils/FunctionComparator.cpp
unittests/Transforms/Utils/FunctionComparatorTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59442.190926.patch
Type: text/x-patch
Size: 3713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190316/e8aa9cbe/attachment.bin>
More information about the llvm-commits
mailing list