Skip to content

Commit c49a1ae

Browse files
committed
DAG: Reorder isFMAFasterThanFMulAndFAdd checks (NFC)
Basic legality checks should be first.
1 parent 3ae71d1 commit c49a1ae

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16134,8 +16134,8 @@ SDValue DAGCombiner::visitFADDForFMACombine(SDNode *N) {
1613416134

1613516135
// Floating-point multiply-add without intermediate rounding.
1613616136
bool HasFMA =
16137-
TLI.isFMAFasterThanFMulAndFAdd(DAG.getMachineFunction(), VT) &&
16138-
(!LegalOperations || matcher.isOperationLegalOrCustom(ISD::FMA, VT));
16137+
(!LegalOperations || matcher.isOperationLegalOrCustom(ISD::FMA, VT)) &&
16138+
TLI.isFMAFasterThanFMulAndFAdd(DAG.getMachineFunction(), VT);
1613916139

1614016140
// No valid opcode, do not combine.
1614116141
if (!HasFMAD && !HasFMA)
@@ -16371,8 +16371,8 @@ SDValue DAGCombiner::visitFSUBForFMACombine(SDNode *N) {
1637116371

1637216372
// Floating-point multiply-add without intermediate rounding.
1637316373
bool HasFMA =
16374-
TLI.isFMAFasterThanFMulAndFAdd(DAG.getMachineFunction(), VT) &&
16375-
(!LegalOperations || matcher.isOperationLegalOrCustom(ISD::FMA, VT));
16374+
(!LegalOperations || matcher.isOperationLegalOrCustom(ISD::FMA, VT)) &&
16375+
TLI.isFMAFasterThanFMulAndFAdd(DAG.getMachineFunction(), VT);
1637616376

1637716377
// No valid opcode, do not combine.
1637816378
if (!HasFMAD && !HasFMA)
@@ -16702,8 +16702,8 @@ SDValue DAGCombiner::visitFMULForFMADistributiveCombine(SDNode *N) {
1670216702
// Floating-point multiply-add without intermediate rounding.
1670316703
bool HasFMA =
1670416704
isContractableFMUL(Options, SDValue(N, 0)) &&
16705-
TLI.isFMAFasterThanFMulAndFAdd(DAG.getMachineFunction(), VT) &&
16706-
(!LegalOperations || TLI.isOperationLegalOrCustom(ISD::FMA, VT));
16705+
(!LegalOperations || TLI.isOperationLegalOrCustom(ISD::FMA, VT)) &&
16706+
TLI.isFMAFasterThanFMulAndFAdd(DAG.getMachineFunction(), VT);
1670716707

1670816708
// Floating-point multiply-add with intermediate rounding. This can result
1670916709
// in a less precise result due to the changed rounding order.

0 commit comments

Comments
 (0)