Skip to content

Commit 66f9448

Browse files
authored
[NFC][ubsan] Pre-commit test with missed optimization (#119012)
1 parent aebd338 commit 66f9448

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s -fsanitize=signed-integer-overflow -mllvm -ubsan-guard-checks -O3 -mllvm -lower-allow-check-random-rate=1 -Rpass=lower-allow-check -Rpass-missed=lower-allow-check -fno-inline 2>&1 | FileCheck %s --check-prefixes=NOINL --implicit-check-not="remark:"
2+
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s -fsanitize=signed-integer-overflow -mllvm -ubsan-guard-checks -O3 -mllvm -lower-allow-check-random-rate=1 -Rpass=lower-allow-check -Rpass-missed=lower-allow-check 2>&1 | FileCheck %s --check-prefixes=INLINE --implicit-check-not="remark:"
3+
4+
int get();
5+
void set(int x);
6+
7+
// We will only make decision in the `overflow` function.
8+
// NOINL-COUNT-1: remark: Allowed check:
9+
10+
// FIXME: We will make decision on every inline.
11+
// INLINE-COUNT-1: remark: Allowed check:
12+
13+
static void overflow() {
14+
set(get() + get());
15+
}
16+
17+
void test() {
18+
overflow();
19+
overflow();
20+
overflow();
21+
overflow();
22+
overflow();
23+
}

0 commit comments

Comments
 (0)