[llvm] [AMDGPU] Respect existing glue when lowering convergence tokens (PR #90834)
Sameer Sahasrabuddhe via llvm-commits
llvm-commits at lists.llvm.org
Mon May 6 02:14:57 PDT 2024
https://github.com/ssahasra updated https://github.com/llvm/llvm-project/pull/90834
>From 897cc6d48aa315c64a0f8bbd0878259cf2b34ed0 Mon Sep 17 00:00:00 2001
From: Sameer Sahasrabuddhe <sameer.sahasrabuddhe at amd.com>
Date: Mon, 6 May 2024 14:25:07 +0530
Subject: [PATCH] [AMDGPU] Respect existing glue when lowering convergence
tokens
---
llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index ed41c10b50d323..3838631c6eac36 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -3860,20 +3860,20 @@ SDValue SITargetLowering::LowerCall(CallLoweringInfo &CLI,
assert(Mask && "Missing call preserved mask for calling convention");
Ops.push_back(DAG.getRegisterMask(Mask));
- if (InGlue.getNode())
- Ops.push_back(InGlue);
-
- // NOTE: This potentially results in *two* glue operands, and the wrong one
- // might possibly show up where the other was intended. In particular,
- // Emitter::EmitMachineNode() expects only the glued convergence token if it
- // exists. Similarly, the selection of the call expects to match only the
- // InGlue operand if it exists.
if (SDValue Token = CLI.ConvergenceControlToken) {
- Ops.push_back(SDValue(DAG.getMachineNode(TargetOpcode::CONVERGENCECTRL_GLUE,
- DL, MVT::Glue, Token),
- 0));
+ SmallVector<SDValue, 2> GlueOps;
+ GlueOps.push_back(Token);
+ if (InGlue)
+ GlueOps.push_back(InGlue);
+
+ InGlue = SDValue(DAG.getMachineNode(TargetOpcode::CONVERGENCECTRL_GLUE, DL,
+ MVT::Glue, GlueOps),
+ 0);
}
+ if (InGlue)
+ Ops.push_back(InGlue);
+
SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Glue);
// If we're doing a tall call, use a TC_RETURN here rather than an
More information about the llvm-commits
mailing list