[PATCH] D95032: [AArch64][GlobalISel] Make G_USUBO legal and select it
Mitch Phillips via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 22 14:16:11 PST 2021
hctim added a comment.
Hi, looks like this patch broke UBSan on aarch64:
Looks like it flips the condition on unsigned-integer-overflow:
volatile uint32_t a = 1;
volatile uint32_t b = 2;
volatile uint32_t c = a - b;
17bc: 52800028 mov w8, #0x1
17c0: 71000908 subs w8, w8, #0x2
prev:
17c4: 54000142 b.cs 17ec no_problems // b.hs, b.nlast
// fallthrough to __ubsan_handle_sub_overflow
now:
17c4: 1a9f37e8 cset w8, cs // cs = hs, nlast
17c8: 360000c8 tbz w8, #0, no_problems
// fallthrough to __ubsan_handle_sub_overflow
The reverse is also true, perfectly valid operands now fail:
int main() {
volatile uint32_t a = 3;
volatile uint32_t b = 2;
volatile uint32_t c = a - b;
}
$ clang a.cpp -fsanitize=unsigned-integer-overflow
$ ./a.out
runtime error: unsigned integer overflow: 3 - 2 cannot be represented in type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
This was caught on our sanitizer Android buildbots: http://lab.llvm.org:8011/#/builders/77/builds/3082
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95032/new/
https://reviews.llvm.org/D95032
More information about the llvm-commits
mailing list