Skip to content

Commit ca8e42f

Browse files
committed
[AMDGPU] Respect existing glue when lowering convergence tokens
1 parent c32a4f8 commit ca8e42f

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3859,20 +3859,19 @@ SDValue SITargetLowering::LowerCall(CallLoweringInfo &CLI,
38593859
assert(Mask && "Missing call preserved mask for calling convention");
38603860
Ops.push_back(DAG.getRegisterMask(Mask));
38613861

3862-
if (InGlue.getNode())
3863-
Ops.push_back(InGlue);
3864-
3865-
// NOTE: This potentially results in *two* glue operands, and the wrong one
3866-
// might possibly show up where the other was intended. In particular,
3867-
// Emitter::EmitMachineNode() expects only the glued convergence token if it
3868-
// exists. Similarly, the selection of the call expects to match only the
3869-
// InGlue operand if it exists.
38703862
if (SDValue Token = CLI.ConvergenceControlToken) {
3871-
Ops.push_back(SDValue(DAG.getMachineNode(TargetOpcode::CONVERGENCECTRL_GLUE,
3872-
DL, MVT::Glue, Token),
3873-
0));
3863+
SmallVector<SDValue, 2> GlueOps;
3864+
GlueOps.push_back(Token);
3865+
if (InGlue.getNode())
3866+
GlueOps.push_back(InGlue);
3867+
3868+
InGlue = SDValue(DAG.getMachineNode(TargetOpcode::CONVERGENCECTRL_GLUE,
3869+
DL, MVT::Glue, GlueOps), 0);
38743870
}
38753871

3872+
if (InGlue.getNode())
3873+
Ops.push_back(InGlue);
3874+
38763875
SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Glue);
38773876

38783877
// If we're doing a tall call, use a TC_RETURN here rather than an

0 commit comments

Comments
 (0)