You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For unsigned integers to check if an addition overflowed (get carry bit) it is enough to compare the sum with one of its arguments carry = sum < a. However, it is not obvious that it is enough to only check one of the arguments and we may encounter a pattern where both arguments are checked.
This patch simplifies the overflow check of unsigned addition.
`a + b <u a` implies `a + b <u b`
`a + b >=u a` implies `a + b >=u b`
Alive2: https://alive2.llvm.org/ce/z/H8oK8nFixes#65863.
legrosbuffle
pushed a commit
to legrosbuffle/llvm-project
that referenced
this issue
Sep 29, 2023
This patch simplifies the overflow check of unsigned addition.
`a + b <u a` implies `a + b <u b`
`a + b >=u a` implies `a + b >=u b`
Alive2: https://alive2.llvm.org/ce/z/H8oK8nFixesllvm#65863.
For unsigned integers to check if an addition overflowed (get carry bit) it is enough to compare the sum with one of its arguments
carry = sum < a
. However, it is not obvious that it is enough to only check one of the arguments and we may encounter a pattern where both arguments are checked.Playground: https://godbolt.org/z/TW8enc6zo
Proof: https://alive2.llvm.org/ce/z/iPAE7t
The text was updated successfully, but these errors were encountered: