[llvm] [DAGCombiner] Remove hasOneUse check from sext+sext_inreg to sext_inreg combine (PR #140207)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Fri May 16 01:19:55 PDT 2025
https://github.com/Pierre-vh updated https://github.com/llvm/llvm-project/pull/140207
>From cd12b2c2f1187e2f7df661abaac8cbdfbfefba85 Mon Sep 17 00:00:00 2001
From: pvanhout <pierre.vanhoutryve at amd.com>
Date: Fri, 16 May 2025 09:06:00 +0200
Subject: [PATCH] [DAGCombiner] Remove hasOneUse check from sext+sext_inreg to
sext_inreg combine
The hasOneUseCheck does not really add anything and makes the combine too
restrictive. Upcoming patches benefit from removing the hasOneUse check.
---
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 8671efcfd2fb1..ddaaafe3346bc 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -14117,7 +14117,7 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
}
// 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));
More information about the llvm-commits
mailing list