Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a <= abs(a) is always true #72653

Closed
k-arrows opened this issue Nov 17, 2023 · 2 comments · Fixed by #76385
Closed

a <= abs(a) is always true #72653

k-arrows opened this issue Nov 17, 2023 · 2 comments · Fixed by #76385

Comments

@k-arrows
Copy link

Alive2 Proof: https://alive2.llvm.org/ce/z/XD9--h
Original program: https://godbolt.org/z/aT8v6G8e9

@k-arrows
Copy link
Author

Other missed optimizations on abs

  1. abs(a) == a --> (a >= 0)
  2. abs(a) == -a --> (a <= 0)

Alive2 Proof: https://alive2.llvm.org/ce/z/UaEEkb
Original program: https://godbolt.org/z/3897dn6fT

@pinskia
Copy link

pinskia commented Nov 19, 2023

I filed the GCC bug report for the full set of comparisons:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112626

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants