https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64774

--- Comment #2 from Michael Bruck <bruck.michael at googlemail dot com> ---
(In reply to Richard Earnshaw from comment #1)
> Although the compiler tries to find some common cases, it is generally
> infeasible to detect all the possible permutations that exist.  Furthermore,
> in real code generating common expressions in this way can increase register
> pressure and have additional impact on some optimization passes.
> 
> I don't hold out much hope of this sort of problem ever being entirely fixed.

I wonder if the logic that recognizes cases 1-3 could be expanded to work with
the rest too. It almost looks to me as if there is a bug that checks the size
of the constant and not the difference to decide what can be substituted with
an addition.

The register pressure issue could be avoided if the optimization is applied
later and only for cases where the value already happens to be in a register.

Reply via email to