[PATCH] D60854: [DAGLegalize][PowerPC] Add promote legalization of addc/adde and subc/sube

Zixuan Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 19 00:02:20 PDT 2019


wuzish added a comment.

In D60854#1472624 <https://reviews.llvm.org/D60854#1472624>, @efriedma wrote:

> Oh, I see, we start with an i32 ADDE, then https://github.com/llvm/llvm-project/blob/e7fe6dd5edb828e702d02c7cdc6565ace4c84f5b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp#L10232 narrows the operation.  We probably shouldn't perform that transform if it would produce an illegal ADDE.




>   if ((N0.getOpcode() == ISD::ADDE || N0.getOpcode() == ISD::ADDCARRY) &&
>        N0.hasOneUse() && !N0.getNode()->hasAnyUseOfValue(1) &&
>        (!LegalOperations || TLI.isOperationLegal(N0.getOpcode(), VT))) {

I think there are 2 conditions to combine as above code does. One is before operation legalization phase (!LegalOperations) and the other one is after. 
In former condition, such transformation is acceptable even operation ADDE is illegal and it only cares about type legality because illegal operation will be legalized later in DAG legalization phase (as I want to promote it). 
So the second condition does consider the legality of ADDE because it's after DAG operation legalization.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D60854





More information about the llvm-commits mailing list