This is an archive of the discontinued LLVM Phabricator instance.

[NaryReassociate] Add support for Mul instructions
AbandonedPublic

Authored by volkan on Sep 14 2015, 2:34 PM.

Details

Reviewers
jingyue
Summary

This patch extends the current pass by handling Mul instructions as well.

Diff Detail

Repository
rL LLVM

Event Timeline

volkan updated this revision to Diff 34734.Sep 14 2015, 2:34 PM
volkan retitled this revision from to [NaryReassociate] Add support for Mul instructions.
volkan updated this object.
volkan set the repository for this revision to rL LLVM.
volkan added a subscriber: llvm-commits.
jingyue requested changes to this revision.Sep 14 2015, 10:03 PM
jingyue edited edge metadata.

LG in general. Some code can be made clearer with refactoring. Thanks for working on this! It has been on my TODO list for quite a long time :)

lib/Transforms/Scalar/NaryReassociate.cpp
473–476

Extract these lines to a helper function, e.g., matchTernaryOp that returns the opcode and outputs A and B as parameters.

485–487

Extract these lines to a helper function, e.g., getBinarySCEV.

This revision now requires changes to proceed.Sep 14 2015, 10:03 PM
volkan updated this revision to Diff 34807.Sep 15 2015, 9:45 AM
volkan edited edge metadata.
volkan marked 2 inline comments as done.

Added matchTernaryOp and getBinarySCEV functions to make the code clearer.

jingyue accepted this revision.Sep 15 2015, 9:54 AM
jingyue edited edge metadata.
This revision is now accepted and ready to land.Sep 15 2015, 9:54 AM
volkan abandoned this revision.Sep 15 2015, 11:47 AM

Committed rL247705.