diff options
author | Walter J.T.V <81811777+eZWALT@users.noreply.github.com> | 2025-06-18 20:52:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-18 20:52:41 +0200 |
commit | 8c3fbaf0ee7322e948403d2234a7230bd6137c98 (patch) | |
tree | 91e706541ccb45a05eebf6ab435b1c214a617a13 /clang/lib/Serialization | |
parent | 17f5b8b52a3552de1143efb42af6a94d47d8c7fd (diff) | |
download | llvm-8c3fbaf0ee7322e948403d2234a7230bd6137c98.zip llvm-8c3fbaf0ee7322e948403d2234a7230bd6137c98.tar.gz llvm-8c3fbaf0ee7322e948403d2234a7230bd6137c98.tar.bz2 |
[Clang][OpenMP][LoopTransformations] Fix incorrect number of generated loops for Tile and Reverse directives (#140532)
This patch is closely related to #139293 and addresses an existing issue
in the loop transformation codebase. Specifically, it corrects the
handling of the `NumGeneratedLoops` variable in
`OMPLoopTransformationDirective` AST nodes and its inheritors (such as
OMPUnrollDirective, OMPTileDirective, etc.).
Previously, this variable was inaccurately set for certain
transformations like reverse or tile. While this did not lead to
functional bugs, since the value was only checked to determine whether
it was greater than zero or equal to zero, the inconsistency could
introduce problems when supporting more complex directives in the
future.
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r-- | clang/lib/Serialization/ASTReaderStmt.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp index 65102b6..44cfb83 100644 --- a/clang/lib/Serialization/ASTReaderStmt.cpp +++ b/clang/lib/Serialization/ASTReaderStmt.cpp @@ -3602,11 +3602,10 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { } case STMT_OMP_REVERSE_DIRECTIVE: { - assert(Record[ASTStmtReader::NumStmtFields] == 1 && - "Reverse directive accepts only a single loop"); + unsigned NumLoops = Record[ASTStmtReader::NumStmtFields]; assert(Record[ASTStmtReader::NumStmtFields + 1] == 0 && "Reverse directive has no clauses"); - S = OMPReverseDirective::CreateEmpty(Context); + S = OMPReverseDirective::CreateEmpty(Context, NumLoops); break; } |