<div dir="ltr">HI All,<div><br></div><div>I am current working with SIMD instruction along with stackmap features. </div><div><br></div><div>Recently I encountered a problem involving legalizing stackmap. In my stackmap, I record all the live values existing at the callsite. One of the operands in my stackmap is an illegal vector type for arm64 architecture (<i>v4f64</i>) and requires vector splitting in order to legalize the node (<i>v2f64</i>). However, I noticed that in the <i>DAGTypeLegalizer::SplitVectorOperand</i> function, the switch case does not handle stackmap cases. So initially every time I run my code with </div><div><br></div><div>  <i>-mllvm -debug-only=legalize_types</i></div><div><br></div><div>I will get an error " Do not know  how to split this operator's operand"</div><div><br></div><div>My first attempt to fix this is to  add an if statment before the switch case to see if the Node is referring to a stackmap, and if so I will get the SDNode of the particular stackmap operand using </div><div><br></div><div><i>N->getOperand(OperandNumber).getNode(); </i></div><div><i><br></i></div><div>and use that instead of the original SDNode in the switch case statement. <br></div><div><br></div><div>For example, if I need to split  the 3rd operand of my stackmap which is an vector operand </div><div>I will create a <i>SDNode</i> that equals to<i> N->getOperand(3).getNode()</i>; </div><div><br></div><div>This attempt gives a failed assertion of " <b>Invalid node ID for RAUW deletion.</b>" </div><div><br></div><div>My next attempt is to add additional instructions to replace the original illegal vector operand with the new resulting legal operand. This can be achieved using <i>ReplaceValueWidth</i>  function (if the stackmap flag is set) to replace the original <i>SDValue</i> of the vector operand with the new Resulting Value (in the function it is denoted as <i>Res</i>) that resulted  from <i>SplittingVecOp_</i>xxx function. </div><div><br></div><div>However, this way I ran into other failed assertion at other locations. </div><div><br></div><div>Right now I am not sure what is an effective way of handling stackmap vector operand in the legalizing phase and I appreciate any suggestions from the community</div><div><br></div><div>Best,</div><div>Yihan  </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div></div>