Skip to content

Commit 239c6ef

Browse files
committed
Add hasOneUse check
1 parent 172f5c3 commit 239c6ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13947,7 +13947,7 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
1394713947
}
1394813948

1394913949
// If the trunc wasn't legal, try to fold to (sext_inreg (anyext x))
13950-
if ((!LegalTypes || TLI.isTypeLegal(VT))) {
13950+
if ((!LegalTypes || TLI.isTypeLegal(VT)) && N0.hasOneUse()) {
1395113951
SDValue ExtSrc = DAG.getAnyExtOrTrunc(N00, DL, VT);
1395213952
return DAG.getNode(ISD::SIGN_EXTEND_INREG, DL, VT, ExtSrc,
1395313953
N0->getOperand(1));

0 commit comments

Comments
 (0)