This is an archive of the discontinued LLVM Phabricator instance.

[Clang][OpenMP] Fix loop directive nested inside a parallel
ClosedPublic

Authored by doru1004 on Jan 11 2023, 11:17 AM.

Details

Summary

This patch fixes the case in which the loop directive is nested within a parallel directive. This patch ensures that the iteration variable has a valid var declaration in the local declare map when the for statement is emitted.

Diff Detail

Event Timeline

doru1004 created this revision.Jan 11 2023, 11:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 11 2023, 11:17 AM
doru1004 requested review of this revision.Jan 11 2023, 11:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 11 2023, 11:17 AM
doru1004 retitled this revision from [Clang][OpenMP] Fix loop directed nested inside a parallel to [Clang][OpenMP] Fix loop directive nested inside a parallel.Jan 11 2023, 11:18 AM
ABataev added inline comments.Jan 11 2023, 11:49 AM
clang/lib/CodeGen/CGStmtOpenMP.cpp
7865
if (const auto *ForS = dyn_cast<ForStmt>(CS); !ForS || !isa<DeclStmt>(ForS->getInit())) {
... 
} else {
  CGF.EmitStmt(CS);
}

Drive by.

clang/test/OpenMP/nested_loop_codegen.cpp
33

Internal?

doru1004 updated this revision to Diff 489035.Jan 13 2023, 9:13 AM
doru1004 updated this revision to Diff 489105.Jan 13 2023, 12:47 PM
doru1004 marked 2 inline comments as done.Jan 16 2023, 7:49 AM
This revision is now accepted and ready to land.Jan 16 2023, 1:25 PM