--- Comment #3 from Leo Yuriev <leo at yuriev dot ru> ---
> (a) < (b) is not equal to ((a) - (b) < 0)
> Compiler will trait them differently.
Yes, of course. Moreover, in the second case, correct sorting requires limiting
the range of keys to avoid overflow when comparing by subtraction.

However, such changes in the code shouldn't cause such a significant
performance change. Moreover, this can't be an excuse for generating slower
code compared to clang.

For clarity:
 - We look to the benchmark of heapsort, with random data, in the two cases:
`small` and `large`.
 - GCC shown unexpected performance changes by minor code changes. 
 - CLANG shown stable result and better perfomance than GCC's in all cases.
 - moreover, GCC shown better performance with -Os rather with -Ofast.

So, seems this is a misoptimization bug.

Reply via email to