<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/105621>105621</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[omp] The implementation of gcc is significantly simpler than that of clang
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vfdff
</td>
</tr>
</table>
<pre>
* test: https://gcc.godbolt.org/z/j6rzrGddh
```
int foo_omp (char *argv[])
{
int sum=20;
int thrdCnt=strtol(argv[1],NULL,10);
#pragma omp parallel num_threads(thrdCnt) reduction(+:sum)
{
int myRank=omp_get_thread_num();
sum+=myRank;
}
return sum;
}
```
* The clang and llvm have different ways to implementation the feature **omp**, If I assume both of them are correct, then base on the final output assemble, we can see that the gcc's code is much more smart.
> gcc: foo_omp(char**)--> foo_omp(char**) [clone ._omp_fn.0]
> llvm: foo_omp(char**) --> foo_omp(char**) (.omp_outlined) --> foo_omp(char**) (.omp_outlined_debug__.omp.reduction.reduction_func)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVFuPozgT_TWVl1IjUyQEHnggzZdPI432YbX7jAwUl1lfkG0y6vn1K5NkutXaixYhsHGdw_HxUUnvl8kwV3C6wKk5yC3M1lW3cRjHQ2eHtwqoxsA-QFbjHMLqIauBrkDXqe-TyQ6dVSGxbgK6_gC6fsvdD_f_YZhBNCBqyMXj3qeLCTha21q9IlDRz9IhUC3ddLsrACofwPPlPkBEjDC_acgaEpB9WgizG15NgKzxwQWrgIoHX7oTvv7y-9evQK-piOQf0UDZ6uSkJUY9q3RSKVZoNt2G2bEcPFDxpKcSHQ9bHxZrgAqgC2R1FPVUvDN-VP0UqN9-leYPyBqr13bi8CBvTQQXn0XFa6e9QNY8oR9Fn5v3ieOwOXP35vI0rvlL6x9PqvG3mbFX0kwozYBK3TTO8sY4LOPIjk3A7_LNY7C46FWxZhNk3DWGmXFkGTbH8dSAaqvX-wDoFb-M-AWl95tm7GyY0Y4RolE6xt46x32IdWFmg530jE_OxUiFdgvrFiIB605xrPzO2EuDnhnDLMNePPU90NljbwfGxaPe-hm1dYxeSxeSn-ZA9r-9OKufkXsk7qm4fHmJNX-ziHC69MoaxiQut6NJRMzTR_ro3T_w47_8gIokMtstqMXw8N8R7cDdNrVt_Jj8TOf7qB030wOVh6HKhjIr5YGr9EzHTJTpURzmqpRF12XHLu1LkkfK03E8Sx5SUfI5zak4LBUJOoqCSOTH01EklKeC84LLXJwpJYajYC0XlUQvYh84LN5vXKXilFN6ULJj5ff2QrSHDohip3FVBLx02-ThKNTig3-nCEtQe0-KJpyaPbGfsmjHeLgxALGDLePSSxPUG_q9zsW8mHto7HhP-2FzqvrUwpYwb13SWw103Q_z_npZnf22p_W678YDXR8bulX0ZwAAAP__qLKUbQ">