1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -no-enable-noundef-analysis -o - %s | \
2 // RUN: FileCheck %s --check-prefix=CLEAN
3 // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -fno-sanitize-memory-param-retval -o - %s | \
4 // RUN: FileCheck %s --check-prefixes=NOUNDEF,NOUNDEF_ONLY
5 // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -mllvm -msan-eager-checks -o - %s | \
6 // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER
7 // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \
8 // RUN: FileCheck %s --check-prefixes=CLEAN
9 // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -o - %s | \
10 // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER
20 // CLEAN: define dso_local void @bar(i32 %x)
21 // NOUNDEF: define dso_local void @bar(i32 noundef %x)
23 // %param_shadow assignment gets optimized away with -O2, because it is at the beginning of the
24 // struct returned by __msan_get_context_state(). Use %param_origin as a sign that the shadow of
25 // the first argument is being used.
27 // Without noundef analysis, KMSAN emits metadata checks for the function parameter.
28 // CLEAN: load i32, ptr %param_origin
30 // With noundef analysis enabled, but without eager checks, KMSAN still emits metadata checks,
31 // although the parameter is known to be defined.
32 // NOUNDEF_ONLY: load i32, ptr %param_origin
34 // With noundef analysis and eager checks enabled, KMSAN won't emit metadata checks for function
36 // EAGER-NOT: load i32, ptr %param_origin