@@ -3191,20 +3191,22 @@ SDValue NVPTXTargetLowering::LowerSTORE(SDValue Op, SelectionDAG &DAG) const {
31913191
31923192SDValue
31933193NVPTXTargetLowering::LowerSTOREVector (SDValue Op, SelectionDAG &DAG) const {
3194- SDNode *N = Op.getNode ();
3194+ MemSDNode *N = cast<MemSDNode>( Op.getNode () );
31953195 SDValue Val = N->getOperand (1 );
31963196 SDLoc DL (N);
3197- EVT ValVT = Val.getValueType ();
3197+ const EVT ValVT = Val.getValueType ();
3198+ const EVT MemVT = N->getMemoryVT ();
3199+ if (ValVT != MemVT)
3200+ return SDValue ();
31983201
31993202 const auto NumEltsAndEltVT = getVectorLoweringShape (ValVT);
32003203 if (!NumEltsAndEltVT)
32013204 return SDValue ();
32023205 const auto [NumElts, EltVT] = NumEltsAndEltVT.value ();
32033206
3204- MemSDNode *MemSD = cast<MemSDNode>(N);
32053207 const DataLayout &TD = DAG.getDataLayout ();
32063208
3207- Align Alignment = MemSD ->getAlign ();
3209+ Align Alignment = N ->getAlign ();
32083210 Align PrefAlign = TD.getPrefTypeAlign (ValVT.getTypeForEVT (*DAG.getContext ()));
32093211 if (Alignment < PrefAlign) {
32103212 // This store is not sufficiently aligned, so bail out and let this vector
@@ -3267,7 +3269,7 @@ NVPTXTargetLowering::LowerSTOREVector(SDValue Op, SelectionDAG &DAG) const {
32673269
32683270 SDValue NewSt =
32693271 DAG.getMemIntrinsicNode (Opcode, DL, DAG.getVTList (MVT::Other), Ops,
3270- MemSD ->getMemoryVT (), MemSD ->getMemOperand ());
3272+ N ->getMemoryVT (), N ->getMemOperand ());
32713273
32723274 // return DCI.CombineTo(N, NewSt, true);
32733275 return NewSt;
@@ -5762,20 +5764,20 @@ static void ReplaceBITCAST(SDNode *Node, SelectionDAG &DAG,
57625764// / ReplaceVectorLoad - Convert vector loads into multi-output scalar loads.
57635765static void ReplaceLoadVector (SDNode *N, SelectionDAG &DAG,
57645766 SmallVectorImpl<SDValue> &Results) {
5765- const EVT ResVT = N->getValueType (0 );
5766- SDLoc DL (N);
5767+ LoadSDNode *LD = cast<LoadSDNode>(N);
5768+ const EVT ResVT = LD->getValueType (0 );
5769+ const EVT MemVT = LD->getMemoryVT ();
5770+ if (ResVT != MemVT)
5771+ return ;
57675772
57685773 const auto NumEltsAndEltVT = getVectorLoweringShape (ResVT);
57695774 if (!NumEltsAndEltVT)
57705775 return ;
57715776 const auto [NumElts, EltVT] = NumEltsAndEltVT.value ();
57725777
5773- LoadSDNode *LD = cast<LoadSDNode>(N);
5774-
57755778 Align Alignment = LD->getAlign ();
57765779 const auto &TD = DAG.getDataLayout ();
5777- Align PrefAlign =
5778- TD.getPrefTypeAlign (LD->getMemoryVT ().getTypeForEVT (*DAG.getContext ()));
5780+ Align PrefAlign = TD.getPrefTypeAlign (MemVT.getTypeForEVT (*DAG.getContext ()));
57795781 if (Alignment < PrefAlign) {
57805782 // This load is not sufficiently aligned, so bail out and let this vector
57815783 // load be scalarized. Note that we may still be able to emit smaller
@@ -5806,9 +5808,10 @@ static void ReplaceLoadVector(SDNode *N, SelectionDAG &DAG,
58065808 break ;
58075809 }
58085810 }
5811+ SDLoc DL (LD);
58095812
58105813 // Copy regular operands
5811- SmallVector<SDValue, 8 > OtherOps (N ->ops ());
5814+ SmallVector<SDValue, 8 > OtherOps (LD ->ops ());
58125815
58135816 // The select routine does not have access to the LoadSDNode instance, so
58145817 // pass along the extension information
0 commit comments