diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 145e5c8173bb2..9217694f26601 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -6627,12 +6627,10 @@ SDValue AArch64TargetLowering::LowerFormalArguments( // make sure it is Glued to the last CopyFromReg value. if (IsLocallyStreaming) { const AArch64RegisterInfo *TRI = Subtarget->getRegisterInfo(); - Chain = DAG.getNode( - AArch64ISD::SMSTART, DL, DAG.getVTList(MVT::Other, MVT::Glue), - {DAG.getRoot(), - DAG.getTargetConstant((int32_t)AArch64SVCR::SVCRSM, DL, MVT::i32), - DAG.getConstant(0, DL, MVT::i64), DAG.getConstant(1, DL, MVT::i64), - DAG.getRegisterMask(TRI->getSMStartStopCallPreservedMask()), Glue}); + Chain = + changeStreamingMode(DAG, DL, /*Enable*/ true, DAG.getRoot(), Glue, + DAG.getConstant(0, DL, MVT::i64), /*Entry*/ true); + // Ensure that the SMSTART happens after the CopyWithChain such that its // chain result is used. for (unsigned I=0; IgetSMStartStopCallPreservedMask())); + Chain = changeStreamingMode( + DAG, DL, /*Enable*/ false, Chain, /*Glue*/ SDValue(), + DAG.getConstant(1, DL, MVT::i64), /*Entry*/ true); Glue = Chain.getValue(1); }