Skip to content

Commit 1c8460d

Browse files
committed
[X86] Remove dead code from combineStore.
Leftovers from before we switched to widening legalization. Fixes PR43919.
1 parent 79c8903 commit 1c8460d

File tree

1 file changed

+10
-44
lines changed

1 file changed

+10
-44
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -40768,54 +40768,20 @@ static SDValue combineStore(SDNode *N, SelectionDAG &DAG,
4076840768
if (!ISD::isNormalLoad(Ld))
4076940769
return SDValue();
4077040770

40771-
// If this is not the MMX case, i.e. we are just turning i64 load/store
40772-
// into f64 load/store, avoid the transformation if there are multiple
40773-
// uses of the loaded value.
40774-
if (!VT.isVector() && !Ld->hasNUsesOfValue(1, 0))
40771+
// Avoid the transformation if there are multiple uses of the loaded value.
40772+
if (!Ld->hasNUsesOfValue(1, 0))
4077540773
return SDValue();
4077640774

4077740775
SDLoc LdDL(Ld);
4077840776
SDLoc StDL(N);
40779-
// If we are a 64-bit capable x86, lower to a single movq load/store pair.
40780-
// Otherwise, if it's legal to use f64 SSE instructions, use f64 load/store
40781-
// pair instead.
40782-
if (Subtarget.is64Bit() || F64IsLegal) {
40783-
MVT LdVT = Subtarget.is64Bit() ? MVT::i64 : MVT::f64;
40784-
SDValue NewLd = DAG.getLoad(LdVT, LdDL, Ld->getChain(), Ld->getBasePtr(),
40785-
Ld->getMemOperand());
40786-
40787-
// Make sure new load is placed in same chain order.
40788-
DAG.makeEquivalentMemoryOrdering(Ld, NewLd);
40789-
return DAG.getStore(St->getChain(), StDL, NewLd, St->getBasePtr(),
40790-
St->getMemOperand());
40791-
}
40792-
40793-
// Otherwise, lower to two pairs of 32-bit loads / stores.
40794-
SDValue LoAddr = Ld->getBasePtr();
40795-
SDValue HiAddr = DAG.getMemBasePlusOffset(LoAddr, 4, LdDL);
40796-
40797-
SDValue LoLd = DAG.getLoad(MVT::i32, LdDL, Ld->getChain(), LoAddr,
40798-
Ld->getPointerInfo(), Ld->getAlignment(),
40799-
Ld->getMemOperand()->getFlags());
40800-
SDValue HiLd = DAG.getLoad(MVT::i32, LdDL, Ld->getChain(), HiAddr,
40801-
Ld->getPointerInfo().getWithOffset(4),
40802-
MinAlign(Ld->getAlignment(), 4),
40803-
Ld->getMemOperand()->getFlags());
40804-
// Make sure new loads are placed in same chain order.
40805-
DAG.makeEquivalentMemoryOrdering(Ld, LoLd);
40806-
DAG.makeEquivalentMemoryOrdering(Ld, HiLd);
40807-
40808-
LoAddr = St->getBasePtr();
40809-
HiAddr = DAG.getMemBasePlusOffset(LoAddr, 4, StDL);
40810-
40811-
SDValue LoSt =
40812-
DAG.getStore(St->getChain(), StDL, LoLd, LoAddr, St->getPointerInfo(),
40813-
St->getAlignment(), St->getMemOperand()->getFlags());
40814-
SDValue HiSt = DAG.getStore(St->getChain(), StDL, HiLd, HiAddr,
40815-
St->getPointerInfo().getWithOffset(4),
40816-
MinAlign(St->getAlignment(), 4),
40817-
St->getMemOperand()->getFlags());
40818-
return DAG.getNode(ISD::TokenFactor, StDL, MVT::Other, LoSt, HiSt);
40777+
// Lower to a single movq load/store pair.
40778+
SDValue NewLd = DAG.getLoad(MVT::f64, LdDL, Ld->getChain(),
40779+
Ld->getBasePtr(), Ld->getMemOperand());
40780+
40781+
// Make sure new load is placed in same chain order.
40782+
DAG.makeEquivalentMemoryOrdering(Ld, NewLd);
40783+
return DAG.getStore(St->getChain(), StDL, NewLd, St->getBasePtr(),
40784+
St->getMemOperand());
4081940785
}
4082040786

4082140787
// This is similar to the above case, but here we handle a scalar 64-bit

0 commit comments

Comments
 (0)