[PATCH] D41574: [Transforms] Adding a WeakReassociate pass
Omer Paparo Bivas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 25 05:26:43 PST 2017
opaparo created this revision.
opaparo added reviewers: craig.topper, spatel, zvi, aaboud, AndreiGrischenko.
Herald added subscribers: mgorny, mehdi_amini.
A discussion that started at https://reviews.llvm.org/D38037 raised the need for a new reassociation pass, in addition to the existing one.
The existing pass takes a tree of a reassociable operator, and transforms it into a "linear tree", e.g. for addition a_0 + (a_1 + (a_2 + ... (a_n-1 + a_n))...). The tree is built such that the latter operands have lower "ranks". The ranking is such that, for example, constants have rank of zero which means they will be at the end of the tree which will cause them to eventually fold.
The new pass implements another kind of reassociation, something of the form (a_0 + a_1) + (a_2 + a_3) -> (a_0 + a_2) + (a_1 + a_3), which is not supported by the existing pass.
The new pass also limited in numerous ways (hence "Weak"): it will only reassociate a tree compound of two kinds of leaves by putting all the leaves of one kind ("LeafClass") in one subtree and the leaves from the other kind at the second subtree. It will also never change the topography of the tree (unlike the existing reassociate pass which aggressively dictates a new topography). That means, amongst the rest, that this pass never creates new instructions.
Repository:
rL LLVM
https://reviews.llvm.org/D41574
Files:
include/llvm/InitializePasses.h
include/llvm/Transforms/Scalar.h
lib/Transforms/IPO/PassManagerBuilder.cpp
lib/Transforms/Scalar/CMakeLists.txt
lib/Transforms/Scalar/Scalar.cpp
lib/Transforms/Scalar/WeakReassociate.cpp
test/Transforms/WeakReassociate/or_or_shift.ll
test/Transforms/WeakReassociate/or_or_xor_and.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41574.128137.patch
Type: text/x-patch
Size: 21052 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171225/fc85fb2c/attachment.bin>
More information about the llvm-commits
mailing list