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

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 24 00:27:11 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-selectiondag

Author: Francesco Petrogalli (fpetrogalli)

<details>
<summary>Changes</summary>

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

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

---
Full diff: https://github.com/llvm/llvm-project/pull/73295.diff


1 Files Affected:

- (modified) llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (+1-1) 


``````````diff
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();

``````````

</details>


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


More information about the llvm-commits mailing list