[DAGCombiner] Remove hasOneUse check from sext+sext_inreg to sext_inreg combine (#140207)
The hasOneUseCheck does not really add anything and makes the combine too
restrictive. Upcoming patches benefit from removing the hasOneUse check.
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 8671efc..ddaaafe 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -14117,7 +14117,7 @@
}
// If the trunc wasn't legal, try to fold to (sext_inreg (anyext x))
- if ((!LegalTypes || TLI.isTypeLegal(VT)) && N0.hasOneUse()) {
+ if (!LegalTypes || TLI.isTypeLegal(VT)) {
SDValue ExtSrc = DAG.getAnyExtOrTrunc(N00, DL, VT);
return DAG.getNode(ISD::SIGN_EXTEND_INREG, DL, VT, ExtSrc,
N0->getOperand(1));