From 1e885ae5307a4111daf533e8fba4d521d7e2c831 Mon Sep 17 00:00:00 2001 From: Alexandre Eichenberger Date: Wed, 18 Sep 2024 11:22:56 -0400 Subject: [PATCH] added warning Signed-off-by: Alexandre Eichenberger --- src/Transform/ProcessKrnlParallelClause.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Transform/ProcessKrnlParallelClause.cpp b/src/Transform/ProcessKrnlParallelClause.cpp index c052ae76c0..2f0d99329a 100644 --- a/src/Transform/ProcessKrnlParallelClause.cpp +++ b/src/Transform/ProcessKrnlParallelClause.cpp @@ -58,6 +58,13 @@ struct ProcessKrnlParallelClauseWithoutScopePattern if (numThreads) { LLVM_DEBUG(llvm::dbgs() << " with a specific num_threads clause\n"); // Set the numbers of threads as indicated by clause op. + // WARNING: by moving the use of numThreads from inside the loop to the + // outer OpenMP parallel construct, we may potentially move the use of + // numThreads before its definition. However, because numThreads is by + // definition loop invariant, it is very unlikely that this case occurs. + // Nevertheless, this warning attests that this might be a possibility. + // In such case, we would get a compiler warning/error of use before + // def. MutableOperandRange mutableNumThreads = parOp.getNumThreadsMutable(); mutableNumThreads.assign(numThreads); }