[Bug tree-optimization/93507] New: Missed abstraction removal in VN

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 30 10:25:00 GMT 2020


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

            Bug ID: 93507
           Summary: Missed abstraction removal in VN
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

Skia (PR92645) contains abstraction that can be simplified to

unsigned long foo(unsigned int x)
{
  unsigned int src = x;
  unsigned long dst = 0;
  __builtin_memcpy (&dst, &src, sizeof (unsigned int));
  return dst;
}

which we should be able to optimize to just zero-extension of x.  But we end
up keeping this all the way through assembling:

foo:
.LFB0:
        .cfi_startproc
        movq    $0, -8(%rsp)
        movl    %edi, -8(%rsp)
        movq    -8(%rsp), %rax
        ret


More information about the Gcc-bugs mailing list