Skip to content

Commit a658cb0

Browse files
committed
[DAGCombiner] Make ShrinkLoadReplaceStoreWithStore return an SDValue instead of an SDNode*. NFCI
The function was calling getNode() on an SDValue to return and the caller turned the result back into a SDValue. So just return the original SDValue to avoid this. llvm-svn: 366779
1 parent f524724 commit a658cb0

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14842,7 +14842,7 @@ CheckForMaskedLoad(SDValue V, SDValue Ptr, SDValue Chain) {
1484214842
/// Check to see if IVal is something that provides a value as specified by
1484314843
/// MaskInfo. If so, replace the specified store with a narrower store of
1484414844
/// truncated IVal.
14845-
static SDNode *
14845+
static SDValue
1484614846
ShrinkLoadReplaceStoreWithStore(const std::pair<unsigned, unsigned> &MaskInfo,
1484714847
SDValue IVal, StoreSDNode *St,
1484814848
DAGCombiner *DC) {
@@ -14854,14 +14854,14 @@ ShrinkLoadReplaceStoreWithStore(const std::pair<unsigned, unsigned> &MaskInfo,
1485414854
// that uses this. If not, this is not a replacement.
1485514855
APInt Mask = ~APInt::getBitsSet(IVal.getValueSizeInBits(),
1485614856
ByteShift*8, (ByteShift+NumBytes)*8);
14857-
if (!DAG.MaskedValueIsZero(IVal, Mask)) return nullptr;
14857+
if (!DAG.MaskedValueIsZero(IVal, Mask)) return SDValue();
1485814858

1485914859
// Check that it is legal on the target to do this. It is legal if the new
1486014860
// VT we're shrinking to (i8/i16/i32) is legal or we're still before type
1486114861
// legalization.
1486214862
MVT VT = MVT::getIntegerVT(NumBytes*8);
1486314863
if (!DC->isTypeLegal(VT))
14864-
return nullptr;
14864+
return SDValue();
1486514865

1486614866
// Okay, we can do this! Replace the 'St' store with a store of IVal that is
1486714867
// shifted by ByteShift and truncated down to NumBytes.
@@ -14895,8 +14895,7 @@ ShrinkLoadReplaceStoreWithStore(const std::pair<unsigned, unsigned> &MaskInfo,
1489514895
++OpsNarrowed;
1489614896
return DAG
1489714897
.getStore(St->getChain(), SDLoc(St), IVal, Ptr,
14898-
St->getPointerInfo().getWithOffset(StOffset), NewAlign)
14899-
.getNode();
14898+
St->getPointerInfo().getWithOffset(StOffset), NewAlign);
1490014899
}
1490114900

1490214901
/// Look for sequence of load / op / store where op is one of 'or', 'xor', and
@@ -14927,16 +14926,16 @@ SDValue DAGCombiner::ReduceLoadOpStoreWidth(SDNode *N) {
1492714926
std::pair<unsigned, unsigned> MaskedLoad;
1492814927
MaskedLoad = CheckForMaskedLoad(Value.getOperand(0), Ptr, Chain);
1492914928
if (MaskedLoad.first)
14930-
if (SDNode *NewST = ShrinkLoadReplaceStoreWithStore(MaskedLoad,
14929+
if (SDValue NewST = ShrinkLoadReplaceStoreWithStore(MaskedLoad,
1493114930
Value.getOperand(1), ST,this))
14932-
return SDValue(NewST, 0);
14931+
return NewST;
1493314932

1493414933
// Or is commutative, so try swapping X and Y.
1493514934
MaskedLoad = CheckForMaskedLoad(Value.getOperand(1), Ptr, Chain);
1493614935
if (MaskedLoad.first)
14937-
if (SDNode *NewST = ShrinkLoadReplaceStoreWithStore(MaskedLoad,
14936+
if (SDValue NewST = ShrinkLoadReplaceStoreWithStore(MaskedLoad,
1493814937
Value.getOperand(0), ST,this))
14939-
return SDValue(NewST, 0);
14938+
return NewST;
1494014939
}
1494114940

1494214941
if ((Opc != ISD::OR && Opc != ISD::XOR && Opc != ISD::AND) ||

0 commit comments

Comments
 (0)