[llvm] [DAGCombiner] Fix type check in visitSRA: use VT for SIGN_EXTEND and TruncVT for TRUNCATE (PR #157580)
Stephen Young via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 10 01:28:16 PDT 2025
https://github.com/StephenYoung2754 updated https://github.com/llvm/llvm-project/pull/157580
>From 1c870834755196cb7e8d973c997ebedde240da91 Mon Sep 17 00:00:00 2001
From: Stephen Young <stephenyoung2754 at outlook.com>
Date: Mon, 8 Sep 2025 20:20:19 +0800
Subject: [PATCH] [DAGCombiner] Fix type check in visitSRA: use VT for
SIGN_EXTEND and TruncVT for TRUNCATE
---
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index d130efe96b56b..0af693a929d3d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -10888,8 +10888,8 @@ SDValue DAGCombiner::visitSRA(SDNode *N) {
// on that type, and the truncate to that type is both legal and free,
// perform the transform.
if ((ShiftAmt > 0) &&
- TLI.isOperationLegalOrCustom(ISD::SIGN_EXTEND, TruncVT) &&
- TLI.isOperationLegalOrCustom(ISD::TRUNCATE, VT) &&
+ TLI.isOperationLegalOrCustom(ISD::SIGN_EXTEND, VT) &&
+ TLI.isOperationLegalOrCustom(ISD::TRUNCATE, TruncVT) &&
TLI.isTruncateFree(VT, TruncVT)) {
SDValue Amt = DAG.getShiftAmountConstant(ShiftAmt, VT, DL);
SDValue Shift = DAG.getNode(ISD::SRL, DL, VT,
More information about the llvm-commits
mailing list