[llvm] d2b6a5a - [LLVM][NVPTX] Fix infinite legalization loop in tcgen05.st (#183012)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 2 04:01:32 PST 2026
Author: Pradeep Kumar
Date: 2026-03-02T17:31:27+05:30
New Revision: d2b6a5a3f6e8a1d9bf0ff2d6329653f9873d3c4d
URL: https://github.com/llvm/llvm-project/commit/d2b6a5a3f6e8a1d9bf0ff2d6329653f9873d3c4d
DIFF: https://github.com/llvm/llvm-project/commit/d2b6a5a3f6e8a1d9bf0ff2d6329653f9873d3c4d.diff
LOG: [LLVM][NVPTX] Fix infinite legalization loop in tcgen05.st (#183012)
This commit adds missing legalizer check without which ISel Lowering gets stuck in an infinite loop
Added:
Modified:
llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
index f5554be155eac..9178990a68b69 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -2568,7 +2568,12 @@ static SDValue LowerVectorArith(SDValue Op, SelectionDAG &DAG) {
return V;
}
-static SDValue lowerTcgen05St(SDValue Op, SelectionDAG &DAG) {
+static SDValue lowerTcgen05St(SDValue Op, SelectionDAG &DAG,
+ bool hasOffset = false) {
+ // skip lowering if the vector operand is already legalized
+ if (!Op->getOperand(hasOffset ? 4 : 3).getValueType().isVector())
+ return Op;
+
SDNode *N = Op.getNode();
SDLoc DL(N);
SmallVector<SDValue, 32> Ops;
@@ -2826,7 +2831,6 @@ static SDValue lowerIntrinsicVoid(SDValue Op, SelectionDAG &DAG) {
switch (IntrinNo) {
default:
break;
- case Intrinsic::nvvm_tcgen05_st_16x64b_x1:
case Intrinsic::nvvm_tcgen05_st_16x64b_x2:
case Intrinsic::nvvm_tcgen05_st_16x64b_x4:
case Intrinsic::nvvm_tcgen05_st_16x64b_x8:
@@ -2846,15 +2850,6 @@ static SDValue lowerIntrinsicVoid(SDValue Op, SelectionDAG &DAG) {
case Intrinsic::nvvm_tcgen05_st_16x256b_x8:
case Intrinsic::nvvm_tcgen05_st_16x256b_x16:
case Intrinsic::nvvm_tcgen05_st_16x256b_x32:
- case Intrinsic::nvvm_tcgen05_st_16x32bx2_x1:
- case Intrinsic::nvvm_tcgen05_st_16x32bx2_x2:
- case Intrinsic::nvvm_tcgen05_st_16x32bx2_x4:
- case Intrinsic::nvvm_tcgen05_st_16x32bx2_x8:
- case Intrinsic::nvvm_tcgen05_st_16x32bx2_x16:
- case Intrinsic::nvvm_tcgen05_st_16x32bx2_x32:
- case Intrinsic::nvvm_tcgen05_st_16x32bx2_x64:
- case Intrinsic::nvvm_tcgen05_st_16x32bx2_x128:
- case Intrinsic::nvvm_tcgen05_st_32x32b_x1:
case Intrinsic::nvvm_tcgen05_st_32x32b_x2:
case Intrinsic::nvvm_tcgen05_st_32x32b_x4:
case Intrinsic::nvvm_tcgen05_st_32x32b_x8:
@@ -2864,6 +2859,14 @@ static SDValue lowerIntrinsicVoid(SDValue Op, SelectionDAG &DAG) {
case Intrinsic::nvvm_tcgen05_st_32x32b_x64:
case Intrinsic::nvvm_tcgen05_st_32x32b_x128:
return lowerTcgen05St(Op, DAG);
+ case Intrinsic::nvvm_tcgen05_st_16x32bx2_x2:
+ case Intrinsic::nvvm_tcgen05_st_16x32bx2_x4:
+ case Intrinsic::nvvm_tcgen05_st_16x32bx2_x8:
+ case Intrinsic::nvvm_tcgen05_st_16x32bx2_x16:
+ case Intrinsic::nvvm_tcgen05_st_16x32bx2_x32:
+ case Intrinsic::nvvm_tcgen05_st_16x32bx2_x64:
+ case Intrinsic::nvvm_tcgen05_st_16x32bx2_x128:
+ return lowerTcgen05St(Op, DAG, /* hasOffset */ true);
case Intrinsic::nvvm_tcgen05_mma_shared_disable_output_lane_cg1:
case Intrinsic::nvvm_tcgen05_mma_shared_disable_output_lane_cg2:
case Intrinsic::nvvm_tcgen05_mma_shared_scale_d_disable_output_lane_cg1:
More information about the llvm-commits
mailing list