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

            Bug ID: 124938
           Summary: Missed reassociation enabling reuse of previously
                    computed values
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kaelfandrew at gmail dot com
  Target Milestone: ---

Created attachment 64242
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64242&action=edit
C code

Taken from https://github.com/llvm/llvm-project/issues/191341

https://godbolt.org/z/6Tzar55e8

Flags are -O2

In godbolt intel assembly:
tgt1 has 1 more mov.
src2 has 1 more lea.

src1 compiles to tgt1 if p2[0] is commented out.
src2 compiles to tgt2 (sub lea becomes lea sub) if p0[0] is commented out.

Reply via email to