<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/127750>127750</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [OpenMP] Compilation times increase as the openmp collapse clause argument value increases
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          itou-fj
      </td>
    </tr>
</table>

<pre>
    In gcc, the compilation time does not increase, but in clang, the compilation time increases exponentially as the argument value of the collapse clause increases.

clang(20.1.0-rc1) compilation time
 collapse(10): 0.111s
 collapse(12): 0.287s
 collapse(14): 3.444s
 collapse(16): 55.497s
 collapse(18): 27m11.931s

gcc(13.3.1-2) compilation time
 collapse(10): 0.044s
 collapse(12): 0.037s
 collapse(14): 0.040s
 collapse(16): 0.037s
 collapse(18): 0.038s
 collapse(20): 0.037s

The testcase

```
#pragma omp parallel for collapse(20) private(a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,o1,p1,q1,r1,s1,t1,u1,v1,w1,x1,y1,z1)
 for(a1=0; a1<=1; ++a1) {
  for(b1=0; b1<1; ++b1) {
   for(c1=0; c1<1; ++c1) {
    for(d1=0; d1<1; ++d1) {
     for(e1=0; e1<1; ++e1) {
      for(f1=0; f1<1; ++f1) {
       for(g1=0; g1<1; ++g1) {
        for(h1=0; h1<1; ++h1) {
         for(i1=0; i1<1; ++i1) {
          for(j1=0; j1<1; ++j1) {
 for(k1=0; k1<1; ++k1) {
            for(l1=0; l1<1; ++l1) {
 for(m1=0; m1<2; ++m1) {
              for(n1=0; n1<1; ++n1) {
 for(o1=0; o1<1; ++o1) {
                for(p1=0; p1<1; ++p1) {
 for(q1=0; q1<1; ++q1) {
                  for(r1=0; r1<1; ++r1) {
 for(s1=0; s1<1; ++s1) {
                    for(t1=0; t1<1; ++t1) {
                     for(u1=0; u1<1; ++u1) {
 for(v1=0; v1<1; ++v1) {
                       for(w1=0; w1<1; ++w1) {
 for(x1=0; x1<1; ++x1) {
 for(y1=0; y1<1; ++y1) {
                          for(z1=0; z1<=1; ++z1) {

 }}}}}}}}}}}}}}}}}}}}}}}}}}
```

[https://godbolt.org/z/31W3j6of5](https://godbolt.org/z/31W3j6of5)


</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyslk-PqzYUxT-Ns7EGGRtPYMGCJIrURdUuKnVtwPzJGMxgk5nk01eXRzx5JnnTSpXQGZh7fvfYBMEVxrR1L2WK-A7xw0ZMttFj2lo9vVSnTa7LS_pbj-uiQHSPbSNxobuhVcK2use27SQutTS41xa3fTFKYSQ48wmucaFEXz8lb4DB8nPQvextK5S6YGFmvxjrqZO9xWehJol1tXRRSgxGQu_J3DUJEMkQyZbImJIgDMjLWISIJqtsRDLXCdE4JIgmiGWYBGEYGr9KXZXG21U1WqosiKJoVX1dqpwHUbKG46VMt10YBgmbwxHJ5jsehyxgQfhC_9sWyINlfG2BsOdbAJY83cJjNr6rxn6VEp9FJPurkdhKYwt4WOb_oFeyHCRDlA2jqDuBdTfgQYxCKalwpcdVYzyM7VlYuBYhovscBH7wfQkiQSqQGqQBaUFOIG8gCqQD6UE0yADyDjKCGBALMoGcQT5APkEuIFd4xmDnlR5_rIUdCGI7DGd7xA4hXCC6Q3Qn5ucRbXfgX4DcAXC2v3PnP7kXe-HshWcvfrYv_tL5S89fev4FkA6QHiB9YCEqR1QeUa2IBakdUntIvUYWpnFM4zHNA2aBWge1HtQ-ghbq5KiTR53uqR_mN2d-88xvDyNuIcpxyuPUOqRzZjjb0y9z9yTkFtM7svdi-nWMdmbtmfXTmFvQ4NjBY4d10Lszv3vm918E3aJGR48ePa6jjDMbz2x-GXULs463Hm-_4ZcGk2sweQ2m9WrPznz2zOfv0m55H67Fh9fiY5336cyfnvlzbb4488UzX75fnFvf1XW5rl-R17tG0AttD__n4X1uSIb4rrF2MIhliB4RPda6zLW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