[llvm] [SelectionDAG] Fix assertion for widening of mask operand in MSTORE. (PR #73295)

Francesco Petrogalli via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 24 00:26:42 PST 2023


https://github.com/fpetrogalli created https://github.com/llvm/llvm-project/pull/73295

According to the code in `SelectionDAG::getMaskedStore`, the Mask operator is in position 4, not 3:

     SDValue Ops[] = {Chain, Val, Base, Offset, Mask};

>From 394e9cb32c6caf781cad313595b851bf1a8a8275 Mon Sep 17 00:00:00 2001
From: Francesco Petrogalli <francesco.petrogalli at apple.com>
Date: Fri, 24 Nov 2023 09:12:38 +0100
Subject: [PATCH] [SelectionDAG] Fix assertion for widening of mask operand in
 MSTORE.

According to the code in `SelectionDAG::getMaskedStore`, the Mask
operator is in position 4, not 3:

     SDValue Ops[] = {Chain, Val, Base, Offset, Mask};
---
 llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
index e24f514273591a7..66461b26468f797 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -6582,7 +6582,7 @@ SDValue DAGTypeLegalizer::WidenVecOp_VP_STRIDED_STORE(SDNode *N,
 }
 
 SDValue DAGTypeLegalizer::WidenVecOp_MSTORE(SDNode *N, unsigned OpNo) {
-  assert((OpNo == 1 || OpNo == 3) &&
+  assert((OpNo == 1 || OpNo == 4) &&
          "Can widen only data or mask operand of mstore");
   MaskedStoreSDNode *MST = cast<MaskedStoreSDNode>(N);
   SDValue Mask = MST->getMask();



More information about the llvm-commits mailing list