[llvm] a40599c - [SelectionDAG][VP] Fix MemSDNode::getBasePtr

Fraser Cormack via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 7 02:04:31 PDT 2021


Author: Fraser Cormack
Date: 2021-09-07T09:54:40+01:00
New Revision: a40599c97bd31871526d2399e8d545daa89ef702

URL: https://github.com/llvm/llvm-project/commit/a40599c97bd31871526d2399e8d545daa89ef702
DIFF: https://github.com/llvm/llvm-project/commit/a40599c97bd31871526d2399e8d545daa89ef702.diff

LOG: [SelectionDAG][VP] Fix MemSDNode::getBasePtr

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

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/SelectionDAGNodes.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
index 781cfc7019d46..9ecba871bc5a4 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -1363,11 +1363,10 @@ class MemSDNode : public SDNode {
     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);


        


More information about the llvm-commits mailing list