@@ -8593,7 +8593,7 @@ SDValue PPCTargetLowering::LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG,
85938593// to insert our load, L, into the chain as a peer of O. To do this, we give L
85948594// the same chain operand as O, we create a token factor from the chain results
85958595// 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 ).
85978597bool PPCTargetLowering::canReuseLoadAddress(SDValue Op, EVT MemVT,
85988598 ReuseLoadInfo &RLI,
85998599 SelectionDAG &DAG,
@@ -8648,27 +8648,6 @@ bool PPCTargetLowering::canReuseLoadAddress(SDValue Op, EVT MemVT,
86488648 return true;
86498649}
86508650
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-
86728651/// Analyze profitability of direct move
86738652/// prefer float load to int load plus direct move
86748653/// when there is no integer use of int load
@@ -8930,7 +8909,8 @@ SDValue PPCTargetLowering::LowerINT_TO_FP(SDValue Op,
89308909 if (canReuseLoadAddress(SINT, MVT::i64, RLI, DAG)) {
89318910 Bits = DAG.getLoad(MVT::f64, dl, RLI.Chain, RLI.Ptr, RLI.MPI,
89328911 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));
89348914 } else if (Subtarget.hasLFIWAX() &&
89358915 canReuseLoadAddress(SINT, MVT::i32, RLI, DAG, ISD::SEXTLOAD)) {
89368916 MachineMemOperand *MMO =
@@ -8940,7 +8920,8 @@ SDValue PPCTargetLowering::LowerINT_TO_FP(SDValue Op,
89408920 Bits = DAG.getMemIntrinsicNode(PPCISD::LFIWAX, dl,
89418921 DAG.getVTList(MVT::f64, MVT::Other),
89428922 Ops, MVT::i32, MMO);
8943- spliceIntoChain(RLI.ResChain, Bits.getValue(1), DAG);
8923+ if (RLI.ResChain)
8924+ DAG.makeEquivalentMemoryOrdering(RLI.ResChain, Bits.getValue(1));
89448925 } else if (Subtarget.hasFPCVT() &&
89458926 canReuseLoadAddress(SINT, MVT::i32, RLI, DAG, ISD::ZEXTLOAD)) {
89468927 MachineMemOperand *MMO =
@@ -8950,7 +8931,8 @@ SDValue PPCTargetLowering::LowerINT_TO_FP(SDValue Op,
89508931 Bits = DAG.getMemIntrinsicNode(PPCISD::LFIWZX, dl,
89518932 DAG.getVTList(MVT::f64, MVT::Other),
89528933 Ops, MVT::i32, MMO);
8953- spliceIntoChain(RLI.ResChain, Bits.getValue(1), DAG);
8934+ if (RLI.ResChain)
8935+ DAG.makeEquivalentMemoryOrdering(RLI.ResChain, Bits.getValue(1));
89548936 } else if (((Subtarget.hasLFIWAX() &&
89558937 SINT.getOpcode() == ISD::SIGN_EXTEND) ||
89568938 (Subtarget.hasFPCVT() &&
@@ -9046,8 +9028,9 @@ SDValue PPCTargetLowering::LowerINT_TO_FP(SDValue Op,
90469028 DAG.getVTList(MVT::f64, MVT::Other), Ops,
90479029 MVT::i32, MMO);
90489030 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+ }
90519034 } else {
90529035 assert(Subtarget.isPPC64() &&
90539036 "i32->FP without LFIWAX supported only on PPC64");
@@ -11669,7 +11652,8 @@ SDValue PPCTargetLowering::LowerSCALAR_TO_VECTOR(SDValue Op,
1166911652 SDValue Bits = DAG.getMemIntrinsicNode(
1167011653 PPCISD::LD_SPLAT, dl, DAG.getVTList(MVT::v4i32, MVT::Other), Ops,
1167111654 MVT::i32, MMO);
11672- spliceIntoChain(RLI.ResChain, Bits.getValue(1), DAG);
11655+ if (RLI.ResChain)
11656+ DAG.makeEquivalentMemoryOrdering(RLI.ResChain, Bits.getValue(1));
1167311657 return Bits.getValue(0);
1167411658 }
1167511659
0 commit comments