aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorNathan Gauër <brioche@google.com>2024-03-28 17:18:05 +0100
committerGitHub <noreply@github.com>2024-03-28 17:18:05 +0100
commit0f61051f541a5b8cfce25c84262dfdbadb9ca688 (patch)
tree2a73540bc7e64d414cdf164a434c987dd9f6128a /clang/lib/CodeGen/CGCall.cpp
parent276335389133d6acf5f9d7d2f8ce09f9c610cb9c (diff)
downloadllvm-0f61051f541a5b8cfce25c84262dfdbadb9ca688.zip
llvm-0f61051f541a5b8cfce25c84262dfdbadb9ca688.tar.gz
llvm-0f61051f541a5b8cfce25c84262dfdbadb9ca688.tar.bz2
[clang][HLSL][SPRI-V] Add convergence intrinsics (#80680)
HLSL has wave operations and other kind of function which required the control flow to either be converged, or respect certain constraints as where and how to re-converge. At the HLSL level, the convergence are mostly obvious: the control flow is expected to re-converge at the end of a scope. Once translated to IR, HLSL scopes disapear. This means we need a way to communicate convergence restrictions down to the backend. For this, the SPIR-V backend uses convergence intrinsics. So this commit adds some code to generate convergence intrinsics when required. --------- Signed-off-by: Nathan Gauër <brioche@google.com>
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index fb00782..a5fe396 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -5715,6 +5715,9 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
if (!CI->getType()->isVoidTy())
CI->setName("call");
+ if (getTarget().getTriple().isSPIRVLogical() && CI->isConvergent())
+ CI = addControlledConvergenceToken(CI);
+
// Update largest vector width from the return type.
LargestVectorWidth =
std::max(LargestVectorWidth, getMaxVectorWidth(CI->getType()));