@@ -5413,21 +5413,18 @@ verifyReturnAddressArgumentIsConstant(SDValue Op, SelectionDAG &DAG) const {
5413
5413
5414
5414
char TargetLowering::isNegatibleForFree (SDValue Op, SelectionDAG &DAG,
5415
5415
bool LegalOperations, bool ForCodeSize,
5416
- bool EnableUseCheck,
5417
5416
unsigned Depth) const {
5418
5417
// fneg is removable even if it has multiple uses.
5419
5418
if (Op.getOpcode () == ISD::FNEG)
5420
5419
return 2 ;
5421
5420
5422
- // If the caller requires checking uses, don't allow anything with multiple
5423
- // uses unless we know it is free.
5421
+ // Don't allow anything with multiple uses unless we know it is free.
5424
5422
EVT VT = Op.getValueType ();
5425
5423
const SDNodeFlags Flags = Op->getFlags ();
5426
5424
const TargetOptions &Options = DAG.getTarget ().Options ;
5427
- if (EnableUseCheck)
5428
- if (!Op.hasOneUse () && !(Op.getOpcode () == ISD::FP_EXTEND &&
5429
- isFPExtFree (VT, Op.getOperand (0 ).getValueType ())))
5430
- return 0 ;
5425
+ if (!Op.hasOneUse () && !(Op.getOpcode () == ISD::FP_EXTEND &&
5426
+ isFPExtFree (VT, Op.getOperand (0 ).getValueType ())))
5427
+ return 0 ;
5431
5428
5432
5429
// Don't recurse exponentially.
5433
5430
if (Depth > SelectionDAG::MaxRecursionDepth)
@@ -5471,11 +5468,11 @@ char TargetLowering::isNegatibleForFree(SDValue Op, SelectionDAG &DAG,
5471
5468
5472
5469
// fold (fneg (fadd A, B)) -> (fsub (fneg A), B)
5473
5470
if (char V = isNegatibleForFree (Op.getOperand (0 ), DAG, LegalOperations,
5474
- ForCodeSize, EnableUseCheck, Depth + 1 ))
5471
+ ForCodeSize, Depth + 1 ))
5475
5472
return V;
5476
5473
// fold (fneg (fadd A, B)) -> (fsub (fneg B), A)
5477
5474
return isNegatibleForFree (Op.getOperand (1 ), DAG, LegalOperations,
5478
- ForCodeSize, EnableUseCheck, Depth + 1 );
5475
+ ForCodeSize, Depth + 1 );
5479
5476
case ISD::FSUB:
5480
5477
// We can't turn -(A-B) into B-A when we honor signed zeros.
5481
5478
if (!Options.NoSignedZerosFPMath && !Flags.hasNoSignedZeros ())
@@ -5488,7 +5485,7 @@ char TargetLowering::isNegatibleForFree(SDValue Op, SelectionDAG &DAG,
5488
5485
case ISD::FDIV:
5489
5486
// fold (fneg (fmul X, Y)) -> (fmul (fneg X), Y) or (fmul X, (fneg Y))
5490
5487
if (char V = isNegatibleForFree (Op.getOperand (0 ), DAG, LegalOperations,
5491
- ForCodeSize, EnableUseCheck, Depth + 1 ))
5488
+ ForCodeSize, Depth + 1 ))
5492
5489
return V;
5493
5490
5494
5491
// Ignore X * 2.0 because that is expected to be canonicalized to X + X.
@@ -5497,7 +5494,7 @@ char TargetLowering::isNegatibleForFree(SDValue Op, SelectionDAG &DAG,
5497
5494
return 0 ;
5498
5495
5499
5496
return isNegatibleForFree (Op.getOperand (1 ), DAG, LegalOperations,
5500
- ForCodeSize, EnableUseCheck, Depth + 1 );
5497
+ ForCodeSize, Depth + 1 );
5501
5498
5502
5499
case ISD::FMA:
5503
5500
case ISD::FMAD: {
@@ -5507,15 +5504,15 @@ char TargetLowering::isNegatibleForFree(SDValue Op, SelectionDAG &DAG,
5507
5504
// fold (fneg (fma X, Y, Z)) -> (fma (fneg X), Y, (fneg Z))
5508
5505
// fold (fneg (fma X, Y, Z)) -> (fma X, (fneg Y), (fneg Z))
5509
5506
char V2 = isNegatibleForFree (Op.getOperand (2 ), DAG, LegalOperations,
5510
- ForCodeSize, EnableUseCheck, Depth + 1 );
5507
+ ForCodeSize, Depth + 1 );
5511
5508
if (!V2)
5512
5509
return 0 ;
5513
5510
5514
5511
// One of Op0/Op1 must be cheaply negatible, then select the cheapest.
5515
5512
char V0 = isNegatibleForFree (Op.getOperand (0 ), DAG, LegalOperations,
5516
- ForCodeSize, EnableUseCheck, Depth + 1 );
5513
+ ForCodeSize, Depth + 1 );
5517
5514
char V1 = isNegatibleForFree (Op.getOperand (1 ), DAG, LegalOperations,
5518
- ForCodeSize, EnableUseCheck, Depth + 1 );
5515
+ ForCodeSize, Depth + 1 );
5519
5516
char V01 = std::max (V0, V1);
5520
5517
return V01 ? std::max (V01, V2) : 0 ;
5521
5518
}
@@ -5524,7 +5521,7 @@ char TargetLowering::isNegatibleForFree(SDValue Op, SelectionDAG &DAG,
5524
5521
case ISD::FP_ROUND:
5525
5522
case ISD::FSIN:
5526
5523
return isNegatibleForFree (Op.getOperand (0 ), DAG, LegalOperations,
5527
- ForCodeSize, EnableUseCheck, Depth + 1 );
5524
+ ForCodeSize, Depth + 1 );
5528
5525
}
5529
5526
5530
5527
return 0 ;
@@ -5568,7 +5565,7 @@ SDValue TargetLowering::getNegatedExpression(SDValue Op, SelectionDAG &DAG,
5568
5565
5569
5566
// fold (fneg (fadd A, B)) -> (fsub (fneg A), B)
5570
5567
if (isNegatibleForFree (Op.getOperand (0 ), DAG, LegalOperations, ForCodeSize,
5571
- false , Depth + 1 ))
5568
+ Depth + 1 ))
5572
5569
return DAG.getNode (ISD::FSUB, SDLoc (Op), Op.getValueType (),
5573
5570
getNegatedExpression (Op.getOperand (0 ), DAG,
5574
5571
LegalOperations, ForCodeSize,
@@ -5595,7 +5592,7 @@ SDValue TargetLowering::getNegatedExpression(SDValue Op, SelectionDAG &DAG,
5595
5592
case ISD::FDIV:
5596
5593
// fold (fneg (fmul X, Y)) -> (fmul (fneg X), Y)
5597
5594
if (isNegatibleForFree (Op.getOperand (0 ), DAG, LegalOperations, ForCodeSize,
5598
- false , Depth + 1 ))
5595
+ Depth + 1 ))
5599
5596
return DAG.getNode (Op.getOpcode (), SDLoc (Op), Op.getValueType (),
5600
5597
getNegatedExpression (Op.getOperand (0 ), DAG,
5601
5598
LegalOperations, ForCodeSize,
@@ -5619,9 +5616,9 @@ SDValue TargetLowering::getNegatedExpression(SDValue Op, SelectionDAG &DAG,
5619
5616
ForCodeSize, Depth + 1 );
5620
5617
5621
5618
char V0 = isNegatibleForFree (Op.getOperand (0 ), DAG, LegalOperations,
5622
- ForCodeSize, false , Depth + 1 );
5619
+ ForCodeSize, Depth + 1 );
5623
5620
char V1 = isNegatibleForFree (Op.getOperand (1 ), DAG, LegalOperations,
5624
- ForCodeSize, false , Depth + 1 );
5621
+ ForCodeSize, Depth + 1 );
5625
5622
if (V0 >= V1) {
5626
5623
// fold (fneg (fma X, Y, Z)) -> (fma (fneg X), Y, (fneg Z))
5627
5624
SDValue Neg0 = getNegatedExpression (
0 commit comments