Skip to content

Commit 897cc6d

Browse files
committed
[AMDGPU] Respect existing glue when lowering convergence tokens
1 parent d98a785 commit 897cc6d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

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

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

3874+
if (InGlue)
3875+
Ops.push_back(InGlue);
3876+
38773877
SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Glue);
38783878

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

0 commit comments

Comments
 (0)