This is an archive of the discontinued LLVM Phabricator instance.

[NFC][DAGCombine] Change the value of NegatibleCost to make it align with the semantics
ClosedPublic

Authored by steven.zhang on Apr 12 2020, 9:03 PM.

Details

Summary

This is a minor NFC change to make the code more clear. We have the NegatibleCost that has cheaper, neutral, and expensive. Typically, the smaller one means the less cost. It is inverse for current implementation, which makes following code not easy to read.
If (CostX > CostY) negate(X)

if (CostX > CostY) {
  // fold (fneg (fma X, Y, Z)) -> (fma (fneg X), Y, (fneg Z))
  SDValue NegX = getNegatedExpression(X, DAG, LegalOps, OptForSize, Depth);
  return DAG.getNode(Opcode, DL, VT, NegX, Y, NegZ, Flags);
}

Diff Detail