summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGClass.cpp
diff options
context:
space:
mode:
authorSteven Perron <stevenperron@google.com>2025-05-15 17:44:34 -0400
committerGitHub <noreply@github.com>2025-05-15 17:44:34 -0400
commit2e6433b8293ac64923c737078e87dc39fc4bced6 (patch)
treed50cbfecdbf130f3e3dcc22363b931e46e2ac496 /clang/lib/CodeGen/CGClass.cpp
parentfc7857ca95bba93807959ad09f983221db8811e1 (diff)
[clang] Emit convergence tokens for loop in global array init (#140120)
When initializing a global array, a loop is generated, but no convergence is emitted for the loop. This fixes that up.
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r--clang/lib/CodeGen/CGClass.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index befbfc64a680..44062739d5dd 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/lib/CodeGen/CGClass.cpp
@@ -2042,6 +2042,8 @@ void CodeGenFunction::EmitCXXAggrConstructorCall(const CXXConstructorDecl *ctor,
cur->addIncoming(arrayBegin, entryBB);
// Inside the loop body, emit the constructor call on the array element.
+ if (CGM.shouldEmitConvergenceTokens())
+ ConvergenceTokenStack.push_back(emitConvergenceLoopToken(loopBB));
// The alignment of the base, adjusted by the size of a single element,
// provides a conservative estimate of the alignment of every element.
@@ -2101,6 +2103,9 @@ void CodeGenFunction::EmitCXXAggrConstructorCall(const CXXConstructorDecl *ctor,
// Patch the earlier check to skip over the loop.
if (zeroCheckBranch) zeroCheckBranch->setSuccessor(0, contBB);
+ if (CGM.shouldEmitConvergenceTokens())
+ ConvergenceTokenStack.pop_back();
+
EmitBlock(contBB);
}