[llvm] [SelectionDAG] Fix unsafe cases for loop.dependence.{war/raw}.mask (PR #168565)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 05:53:31 PST 2025


================
@@ -1820,6 +1820,12 @@ SDValue VectorLegalizer::ExpandLOOP_DEPENDENCE_MASK(SDNode *N) {
   EVT VT = N->getValueType(0);
   EVT PtrVT = SourceValue->getValueType(0);
 
+  SDValue Offset = N->getOperand(3);
+  if (VT.isScalableVT())
+    Offset = DAG.getVScale(DL, PtrVT, N->getConstantOperandAPInt(3));
+
+  SourceValue = DAG.getNode(ISD::ADD, DL, PtrVT, SourceValue,
+                            DAG.getNode(ISD::MUL, DL, PtrVT, EltSize, Offset));
----------------
MacDue wrote:

I don't think we want to do this, this has the same problem with adding to PtrA, right? I think instead we want to add a splat of `LaneOffset` to the `VectorStep`.

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


More information about the llvm-commits mailing list