aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.h
diff options
context:
space:
mode:
authorNathan Gauër <brioche@google.com>2024-05-14 17:00:40 +0200
committerGitHub <noreply@github.com>2024-05-14 17:00:40 +0200
commite08f1fda7508138d408cd61608bcbf30f8c3bb4d (patch)
tree5708a1d5a1b975ee35be54b33ecccc66ed8c8281 /clang/lib/CodeGen/CodeGenModule.h
parenta4accdfe0c9415ad1bd3dac7dda8cb8bbcd1be2f (diff)
downloadllvm-e08f1fda7508138d408cd61608bcbf30f8c3bb4d.zip
llvm-e08f1fda7508138d408cd61608bcbf30f8c3bb4d.tar.gz
llvm-e08f1fda7508138d408cd61608bcbf30f8c3bb4d.tar.bz2
[clang][SPIR-V] Always add convergence intrinsics (#88918)
PR #80680 added bits in the codegen to lazily add convergence intrinsics when required. This logic relied on the LoopStack. The issue is when parsing the condition, the loopstack doesn't yet reflect the correct values, as expected since we are not yet in the loop. However, convergence tokens should sometimes already be available. The solution which seemed the simplest is to greedily generate the tokens when we generate SPIR-V. Fixes #88144 --------- Signed-off-by: Nathan Gauër <brioche@google.com>
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index be43a18..0f68418 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -1586,6 +1586,14 @@ public:
void AddGlobalDtor(llvm::Function *Dtor, int Priority = 65535,
bool IsDtorAttrFunc = false);
+ // Return whether structured convergence intrinsics should be generated for
+ // this target.
+ bool shouldEmitConvergenceTokens() const {
+ // TODO: this should probably become unconditional once the controlled
+ // convergence becomes the norm.
+ return getTriple().isSPIRVLogical();
+ }
+
private:
llvm::Constant *GetOrCreateLLVMFunction(
StringRef MangledName, llvm::Type *Ty, GlobalDecl D, bool ForVTable,