[PATCH] D133471: [DAGCombiner][X86] Fold (sub (subcarry X, 0, Carry), Y) -> (subcarry X, Y, Carry)

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 08:31:42 PDT 2022


craig.topper added a comment.

In D133471#3777069 <https://reviews.llvm.org/D133471#3777069>, @spatel wrote:

> Is the transform still profitable if the subcarry has another use? (not sure how to write a test for that)

I copied this code from visitAddLikeCommutative and changed ADDCARRY to SUBCARRY. So any one uses check is also missing there.

> In IR, it looks like we'd reduce the equivalent of "subcarry X, 0, Carry" to "usubo X, Carry". Are those the same semantics for this node? And would that simpler transform make sense in SDAG too?

Carry here has bool type so I don't think we can fold it to "usubo X, Carry" without an extend.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133471



More information about the llvm-commits mailing list