<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64583>64583</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Optimization Comparison (Clang vs GCC)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
Consider the following two functions:
```c
bool foo(int a, int b, int c)
{
return ((a < b) && (b < c)) && (a < c);
}
bool bar(int a, int b, int c)
{
return (a < b) && (b < c);
}
```
Clang performs three comparison instructions in `foo`, while GCC performs only two comparison instructions in both `foo` and `bar`.
Godbolt:
https://godbolt.org/z/485TMGbGv
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUktFunDwQhZ9muBllZQbWiy-4SIjYq1__TV_ABu_i1tgr22SVPH1lSEraSq0qITEea44_nTMyRnN1WrdwfILjcyGXNPnQfnuQIfh7LJQfX9vOu2hGHTBNGi_eWn837orp7vGyuCEZ7yJUj8CegT0CZ9s3bGflvcWL90CNcQklUIe5UB_FACTeR09PW4GIGHRagkOgBqiRCFWXRwQCcSCe-2ptruM_9eXer54-lJ_fi51JyfBPTDvQ32h-f_XDk88QnZXuijcdLj7MEdMUtMbBzzcZTPQOjYspLJu7aBwCZ9lGzjLkfTJW47nrdgHv7OuayR80lE_TLoTSjfmUneDs8Bnu7EflbfqR6pTSbc2YeqD-ut0efLgC9W9Afd0cv_x3VueXYmyrUVRCFrotuSj58VQdRTG1g6qqWutyHJQgxRvBT03JtKjoIrlQdWFaYlSxpmSsqUUpDsNQlycmJQl9GpgkqJmepbEHa1_m_HZhYlx0y-tjUxVWKm3jusdETt9xvQSivNahzTMParlGqJk1McVdJZlkdfv_LZnZvMnsFXa7hUDNltRLzH4DiWIJtv3FEJOmRR0GPwP1Wfj993AL_qseElC_4kSgfsX9HgAA__96dAU4">