diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-10-16 20:25:18 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-10-16 20:31:04 +0200 |
commit | 492a4a428f77556d413c2179fad9ba4ae6d130b9 (patch) | |
tree | fc71652970ed308e9d3e136e89c9230195fa57cc /clang/lib/CodeGen | |
parent | 2c941fa2f9b9a93b42bdddc810a817b02a937b55 (diff) | |
download | llvm-492a4a428f77556d413c2179fad9ba4ae6d130b9.zip llvm-492a4a428f77556d413c2179fad9ba4ae6d130b9.tar.gz llvm-492a4a428f77556d413c2179fad9ba4ae6d130b9.tar.bz2 |
[APInt] Fix 1-bit edge case in smul_ov()
The sdiv used to check for overflow can itself overflow if the
LHS is signed min and the RHS is -1. The code tried to account for
this by also checking the commuted version. However, for 1-bit
values, signed min and -1 are the same value, so both divisions
overflow. As such, the overflow for -1 * -1 was not detected
(which results in -1 rather than 1 for 1-bit values). Fix this by
explicitly checking for this case instead.
Noticed while adding exhaustive test coverage for smul_ov(),
which is also part of this commit.
Diffstat (limited to 'clang/lib/CodeGen')
0 files changed, 0 insertions, 0 deletions