@@ -8593,7 +8593,7 @@ SDValue PPCTargetLowering::LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG,
8593
8593
// to insert our load, L, into the chain as a peer of O. To do this, we give L
8594
8594
// the same chain operand as O, we create a token factor from the chain results
8595
8595
// of O and L, and we replace all uses of O's chain result with that token
8596
- // factor (see spliceIntoChain below for this last part ).
8596
+ // factor (this last part is handled by makeEquivalentMemoryOrdering ).
8597
8597
bool PPCTargetLowering::canReuseLoadAddress(SDValue Op, EVT MemVT,
8598
8598
ReuseLoadInfo &RLI,
8599
8599
SelectionDAG &DAG,
@@ -8648,27 +8648,6 @@ bool PPCTargetLowering::canReuseLoadAddress(SDValue Op, EVT MemVT,
8648
8648
return true;
8649
8649
}
8650
8650
8651
- // Given the head of the old chain, ResChain, insert a token factor containing
8652
- // it and NewResChain, and make users of ResChain now be users of that token
8653
- // factor.
8654
- // TODO: Remove and use DAG::makeEquivalentMemoryOrdering() instead.
8655
- void PPCTargetLowering::spliceIntoChain(SDValue ResChain,
8656
- SDValue NewResChain,
8657
- SelectionDAG &DAG) const {
8658
- if (!ResChain)
8659
- return;
8660
-
8661
- SDLoc dl(NewResChain);
8662
-
8663
- SDValue TF = DAG.getNode(ISD::TokenFactor, dl, MVT::Other,
8664
- NewResChain, DAG.getUNDEF(MVT::Other));
8665
- assert(TF.getNode() != NewResChain.getNode() &&
8666
- "A new TF really is required here");
8667
-
8668
- DAG.ReplaceAllUsesOfValueWith(ResChain, TF);
8669
- DAG.UpdateNodeOperands(TF.getNode(), ResChain, NewResChain);
8670
- }
8671
-
8672
8651
/// Analyze profitability of direct move
8673
8652
/// prefer float load to int load plus direct move
8674
8653
/// when there is no integer use of int load
@@ -8930,7 +8909,8 @@ SDValue PPCTargetLowering::LowerINT_TO_FP(SDValue Op,
8930
8909
if (canReuseLoadAddress(SINT, MVT::i64, RLI, DAG)) {
8931
8910
Bits = DAG.getLoad(MVT::f64, dl, RLI.Chain, RLI.Ptr, RLI.MPI,
8932
8911
RLI.Alignment, RLI.MMOFlags(), RLI.AAInfo, RLI.Ranges);
8933
- spliceIntoChain(RLI.ResChain, Bits.getValue(1), DAG);
8912
+ if (RLI.ResChain)
8913
+ DAG.makeEquivalentMemoryOrdering(RLI.ResChain, Bits.getValue(1));
8934
8914
} else if (Subtarget.hasLFIWAX() &&
8935
8915
canReuseLoadAddress(SINT, MVT::i32, RLI, DAG, ISD::SEXTLOAD)) {
8936
8916
MachineMemOperand *MMO =
@@ -8940,7 +8920,8 @@ SDValue PPCTargetLowering::LowerINT_TO_FP(SDValue Op,
8940
8920
Bits = DAG.getMemIntrinsicNode(PPCISD::LFIWAX, dl,
8941
8921
DAG.getVTList(MVT::f64, MVT::Other),
8942
8922
Ops, MVT::i32, MMO);
8943
- spliceIntoChain(RLI.ResChain, Bits.getValue(1), DAG);
8923
+ if (RLI.ResChain)
8924
+ DAG.makeEquivalentMemoryOrdering(RLI.ResChain, Bits.getValue(1));
8944
8925
} else if (Subtarget.hasFPCVT() &&
8945
8926
canReuseLoadAddress(SINT, MVT::i32, RLI, DAG, ISD::ZEXTLOAD)) {
8946
8927
MachineMemOperand *MMO =
@@ -8950,7 +8931,8 @@ SDValue PPCTargetLowering::LowerINT_TO_FP(SDValue Op,
8950
8931
Bits = DAG.getMemIntrinsicNode(PPCISD::LFIWZX, dl,
8951
8932
DAG.getVTList(MVT::f64, MVT::Other),
8952
8933
Ops, MVT::i32, MMO);
8953
- spliceIntoChain(RLI.ResChain, Bits.getValue(1), DAG);
8934
+ if (RLI.ResChain)
8935
+ DAG.makeEquivalentMemoryOrdering(RLI.ResChain, Bits.getValue(1));
8954
8936
} else if (((Subtarget.hasLFIWAX() &&
8955
8937
SINT.getOpcode() == ISD::SIGN_EXTEND) ||
8956
8938
(Subtarget.hasFPCVT() &&
@@ -9046,8 +9028,9 @@ SDValue PPCTargetLowering::LowerINT_TO_FP(SDValue Op,
9046
9028
DAG.getVTList(MVT::f64, MVT::Other), Ops,
9047
9029
MVT::i32, MMO);
9048
9030
Chain = Ld.getValue(1);
9049
- if (ReusingLoad)
9050
- spliceIntoChain(RLI.ResChain, Ld.getValue(1), DAG);
9031
+ if (ReusingLoad && RLI.ResChain) {
9032
+ DAG.makeEquivalentMemoryOrdering(RLI.ResChain, Ld.getValue(1));
9033
+ }
9051
9034
} else {
9052
9035
assert(Subtarget.isPPC64() &&
9053
9036
"i32->FP without LFIWAX supported only on PPC64");
@@ -11669,7 +11652,8 @@ SDValue PPCTargetLowering::LowerSCALAR_TO_VECTOR(SDValue Op,
11669
11652
SDValue Bits = DAG.getMemIntrinsicNode(
11670
11653
PPCISD::LD_SPLAT, dl, DAG.getVTList(MVT::v4i32, MVT::Other), Ops,
11671
11654
MVT::i32, MMO);
11672
- spliceIntoChain(RLI.ResChain, Bits.getValue(1), DAG);
11655
+ if (RLI.ResChain)
11656
+ DAG.makeEquivalentMemoryOrdering(RLI.ResChain, Bits.getValue(1));
11673
11657
return Bits.getValue(0);
11674
11658
}
11675
11659
0 commit comments