| 1 |
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 6 |
| 2 |
|
| 3 |
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -O1 -o - %s \ |
| 4 |
// RUN: | FileCheck %s --check-prefixes=CLEAN-O1 |
| 5 |
|
| 6 |
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -O1 -o - %s \ |
| 7 |
// RUN: -fsanitize=signed-integer-overflow \ |
| 8 |
// RUN: -fsanitize-skip-hot-cutoff=signed-integer-overflow=1.0 \ |
| 9 |
// RUN: -fallow-runtime-check-skip-hot-cutoff=1.0 \ |
| 10 |
// RUN: | FileCheck %s --check-prefixes=UBSAN-O1 |
| 11 |
|
| 12 |
// This test shows that -fsanitize-skip-hot-cutoff=...=1.0 plus |
| 13 |
// -fallow-runtime-check-skip-hot-cutoff=1.0 does not perfectly undo the |
| 14 |
// effects of -fsanitize. |
| 15 |
|
| 16 |
// CLEAN-O1-LABEL: define dso_local i32 @overflow( |
| 17 |
// CLEAN-O1-SAME: i32 noundef [[X:%.*]], i32 noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { |
| 18 |
// CLEAN-O1-NEXT: [[ENTRY:.*:]] |
| 19 |
// CLEAN-O1-NEXT: [[ADD:%.*]] = add nsw i32 [[Y]], [[X]] |
| 20 |
// CLEAN-O1-NEXT: ret i32 [[ADD]] |
| 21 |
// |
| 22 |
// UBSAN-O1-LABEL: define dso_local noundef i32 @overflow( |
| 23 |
// UBSAN-O1-SAME: i32 noundef [[X:%.*]], i32 noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { |
| 24 |
// UBSAN-O1-NEXT: [[ENTRY:.*:]] |
| 25 |
// UBSAN-O1-NEXT: [[TMP0:%.*]] = add i32 [[X]], [[Y]] |
| 26 |
// UBSAN-O1-NEXT: ret i32 [[TMP0]] |
| 27 |
// |
| 28 |
int overflow(int x, int y) { |
| 29 |
return x + y; |
| 30 |
} |