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

            Bug ID: 94782
           Summary: Simple multiplication-related arithmetic not optimized
                    to direct multiplication
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

int f(int a, int b)
{
    return (int)((a - 1U) * b) + b;
}

Can be optimized to `a * b`. LLVM does this transformation, GCC does not.

Comparison here : https://godbolt.org/z/LFJwFJ

Reply via email to