Issue 64654
Summary [flang] compilation hangs in CheckScopeConstraints
Labels new issue
Assignees
Reporter k-arrows
    The following test program causes a hang, and it is documented in llvm-test-suite. (See https://github.com/llvm/llvm-test-suite/blob/5942ca45a1036ace15b70e117d636ecf89224957/Fortran/gfortran/regression/DisabledFiles.cmake#L1974)
https://github.com/llvm/llvm-test-suite/blob/main/Fortran/gfortran/regression/goto_5.f90

I will write here what I confirmed about this hang using the perf command.

perf record & perf report:
```console
$ timeout 10 perf record -g flang-new -c goto_5.f90
[ perf record: Woken up 10 times to write data ]
[ perf record: Captured and wrote 2.393 MB perf.data (39133 samples) ]
$ perf report | c++filt
```

Here is the output of the perf report command:
```console
    99.88%    99.88%  flang-new flang-new             [.] Fortran::semantics::CheckScopeConstraints(std::vector<Fortran::semantics::SourceStatementInfoTuplePOD, std::allocator<Fortran::semantics::SourceStatementInfoTuplePOD> > const&, std::map<unsigned long, Fortran::semantics::LabeledStatementInfoTuplePOD, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, Fortran::semantics::LabeledStatementInfoTuplePOD> > > const&, std::vector<Fortran::semantics::ScopeInfo, std::allocator<Fortran::semantics::ScopeInfo> > const&, Fortran::semantics::SemanticsContext&)
            |
 ---Fortran::semantics::CheckScopeConstraints(std::vector<Fortran::semantics::SourceStatementInfoTuplePOD, std::allocator<Fortran::semantics::SourceStatementInfoTuplePOD> > const&, std::map<unsigned long, Fortran::semantics::LabeledStatementInfoTuplePOD, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, Fortran::semantics::LabeledStatementInfoTuplePOD> > > const&, std::vector<Fortran::semantics::ScopeInfo, std::allocator<Fortran::semantics::ScopeInfo> > const&, Fortran::semantics::SemanticsContext&)
```

>From this output, we can see that almost all the time of compilation is spent with the symbol `Fortran::semantics::CheckScopeConstraints`. This symbol seems to come from a function called `CheckScopeConstraints` in the namespace `Fortran::semantics`.

https://github.com/llvm/llvm-project/blob/d923f4c2d824f42817d5a1d8fee9272ce3923f42/flang/lib/Semantics/resolve-labels.cpp#L989
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to