Skip to content

missed optimization for y / x when the divisor has [0, 1] range #74242

Closed
@k-arrows

Description

@k-arrows

Test case:
https://godbolt.org/z/aonazK5on

unsigned int 
foo(unsigned int x, unsigned int y)
{
  if(x > 1)
    return y;
  return y / x;
}

motivated from the following gcc bugzilla and test:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96094
https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.dg/tree-ssa/pr96094.c

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions