[llvm] [AMDGPU] In VectorLegalizer::Expand, if UnrollVectorOp returns Load, … (PR #88475)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 11:57:51 PDT 2024


================
@@ -1159,8 +1159,14 @@ void VectorLegalizer::Expand(SDNode *Node, SmallVectorImpl<SDValue> &Results) {
   }
 
   SDValue Unrolled = DAG.UnrollVectorOp(Node);
-  for (unsigned I = 0, E = Unrolled->getNumValues(); I != E; ++I)
-    Results.push_back(Unrolled.getValue(I));
+  if (Node->getNumValues() == 1) {
+    Results.push_back(Unrolled);
+  } else {
+    assert(Node->getNumValues() == Unrolled->getNumValues() &&
+      "VectorLegalizer Expand returned wrong number of results!");
----------------
topperc wrote:

In the 1 case, there is no guarantee they will match. For the failure case, `Unrolled` is a load that has 2 results so it won't match Node->getNumValues().

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


More information about the llvm-commits mailing list