Skip to content

Commit 14f212e

Browse files
committed
fixup! [RISCV] Optimized and with atomic_load into zextload when safe.
1 parent fbdbcf7 commit 14f212e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15283,6 +15283,8 @@ static SDValue reduceANDOfAtomicLoad(SDNode *N,
1528315283
SDValue N0 = N->getOperand(0);
1528415284
if (N0.getOpcode() != ISD::ATOMIC_LOAD)
1528515285
return SDValue();
15286+
if (!N0.hasOneUse())
15287+
return SDValue();
1528615288

1528715289
AtomicSDNode *ALoad = cast<AtomicSDNode>(N0.getNode());
1528815290
if (isStrongerThanMonotonic(ALoad->getSuccessOrdering()))
@@ -15310,7 +15312,7 @@ static SDValue reduceANDOfAtomicLoad(SDNode *N,
1531015312
SDValue ZextLoad = DAG.getExtLoad(ISD::ZEXTLOAD, DL, ResultVT, Chain, Ptr,
1531115313
MemOp->getPointerInfo(), LoadedVT,
1531215314
MemOp->getAlign(), MemOp->getFlags());
15313-
DAG.ReplaceAllUsesOfValueWith(SDValue(N, 0), ZextLoad);
15315+
DCI.CombineTo(N, ZextLoad);
1531415316
DAG.ReplaceAllUsesOfValueWith(SDValue(N0.getNode(), 1), ZextLoad.getValue(1));
1531515317
DCI.recursivelyDeleteUnusedNodes(N0.getNode());
1531615318
return SDValue(N, 0);

0 commit comments

Comments
 (0)