@@ -9531,6 +9531,11 @@ void SelectionDAGBuilder::populateCallLoweringInfo(
95319531 Call->countOperandBundlesOfType (LLVMContext::OB_preallocated) != 0 );
95329532}
95339533
9534+ // Is the node `N` a glue or chain node?
9535+ bool isGlueOrChain (const SDValue &N) {
9536+ return (N.getValueType () == MVT::Other) || (N.getValueType () == MVT::Glue);
9537+ }
9538+
95349539// / Given the stackmap live variable `N`, search its sub-DAG and return all of
95359540// / the constituent values that need to be reported in the stackmap table.
95369541static std::vector<SDValue> findLiveConstituents (SelectionDAG &DAG,
@@ -9542,8 +9547,11 @@ static std::vector<SDValue> findLiveConstituents(SelectionDAG &DAG,
95429547 case ISD::CONCAT_VECTORS:
95439548 case ISD::MERGE_VALUES:
95449549 case ISD::BUILD_VECTOR:
9545- for (SDValue Op : N->op_values ())
9546- V.push_back (Op);
9550+ for (SDValue Op : N->op_values ()) {
9551+ if (!isGlueOrChain (Op)) {
9552+ V.push_back (Op);
9553+ }
9554+ }
95479555 break ;
95489556 case ISD::INSERT_VECTOR_ELT: {
95499557 V = findLiveConstituents (DAG, N.getOperand (0 ));
@@ -9556,6 +9564,14 @@ static std::vector<SDValue> findLiveConstituents(SelectionDAG &DAG,
95569564 V.push_back (N);
95579565 }
95589566
9567+ // We have to be careful not to ask the stackmap to record the locations
9568+ // of glue or chain operands. That would make no sense, as glue and chain
9569+ // operands are not real data, rather control dependencies that are an
9570+ // artefact of using a DAG.
9571+ for (SDValue &VV: V) {
9572+ assert (!isGlueOrChain (VV));
9573+ }
9574+
95599575 return V;
95609576}
95619577
0 commit comments