[PATCH] D100884: Generalize getInvertibleOperand to support mismatched phi operand order

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 15:08:33 PDT 2021


reames added a comment.

In D100884#2703064 <https://reviews.llvm.org/D100884#2703064>, @nikic wrote:

> I don't think this is particularly valuable in terms of optimization power, but I do think the interface makes a bit more sense that way. Though I would suggest to go one step further and return `std::pair<Value *, Value *>`. That is, for a pair of input values, it returns a pair of output values that preserve the equality relationship. This should make the phi case particularly nice, because you can simply return `{Start1, Start2}` rather than checking for different possibilities of operand orders.

I played with this, but it turns out a bit more ugly than it sounds.  It requires a bunch of duplicated boilerplate for the non-phi return points, and more importantly, greatly complicates the check to see that the recurrence is the LHS of the operation.  I really didn't care for the resulting code structure.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100884/new/

https://reviews.llvm.org/D100884



More information about the llvm-commits mailing list