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

Sam Tebbs via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 27 09:30:28 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));
----------------
SamTebbs33 wrote:

Ah yes you're right, done :+1: 

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


More information about the llvm-commits mailing list