[SelectionDAG][VP] Fix MemSDNode::getBasePtr
authorFraser Cormack <fraser@codeplay.com>
Mon, 6 Sep 2021 09:23:56 +0000 (10:23 +0100)
committerFraser Cormack <fraser@codeplay.com>
Tue, 7 Sep 2021 08:54:40 +0000 (09:54 +0100)
Found while working on D108987. When interpreting VP nodes as
`MemSDNode` nodes, this function would return the incorrect indices.
This was due to `VP_GATHER` and having no "passthru", and both
`VP_GATHER` and `VP_SCATTER` having their mask operands *after* the base
pointer, unlike `MGATHER` and `MSCATTER`.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D109308

llvm/include/llvm/CodeGen/SelectionDAGNodes.h

index 781cfc7..9ecba87 100644 (file)
@@ -1363,11 +1363,10 @@ public:
     case ISD::STORE:
     case ISD::VP_STORE:
     case ISD::MSTORE:
+    case ISD::VP_SCATTER:
       return getOperand(2);
     case ISD::MGATHER:
     case ISD::MSCATTER:
-    case ISD::VP_GATHER:
-    case ISD::VP_SCATTER:
       return getOperand(3);
     default:
       return getOperand(1);