[flang-commits] [flang] [flang][OpenMP] Provide reasons for calculated depths (PR #187781)
Michael Kruse via flang-commits
flang-commits at lists.llvm.org
Mon Mar 23 08:26:21 PDT 2026
================
@@ -1157,45 +1157,68 @@ std::optional<int64_t> LoopSequence::getNestedLength() const {
}
LoopSequence::Depth LoopSequence::calculateDepths() const {
- auto plus{[](std::optional<int64_t> a,
- std::optional<int64_t> b) -> std::optional<int64_t> {
- if (a && b) {
- return *a + *b;
- }
- return std::nullopt;
- }};
-
- // The sequence length is calculated first, so we already know if this
- // sequence is a nest or not.
- if (!isNest()) {
- return Depth{0, 0};
- }
-
// Get the length of the nested sequence. The invalidIC_ and opaqueIC_
// members do not count canonical loop nests, but there can only be one
// for depth to make sense.
std::optional<int64_t> length{getNestedLength()};
// Get the depths of the code nested in this sequence (e.g. contained in
// entry_), and use it as the basis for the depths of entry_->owner.
auto [semaDepth, perfDepth]{getNestedDepths()};
- if (invalidIC_ || length.value_or(0) != 1) {
- semaDepth = perfDepth = 0;
- } else if (opaqueIC_ || length.value_or(0) != 1) {
- perfDepth = 0;
+ if (invalidIC_) {
+ parser::CharBlock source{*parser::GetSource(*invalidIC_)};
+ if (semaDepth.value > 9) {
----------------
Meinersbur wrote:
What is the meaning of the magic number `9`?
https://github.com/llvm/llvm-project/pull/187781
More information about the flang-commits
mailing list