brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 9cd6d8b Raw
37 lines · c
1// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -O2 -fsanitize=kernel-memory -no-enable-noundef-analysis -o - %s | \2// RUN:     FileCheck %s --check-prefix=CLEAN3// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -O2 -fsanitize=kernel-memory -fno-sanitize-memory-param-retval -o - %s | \4// RUN:     FileCheck %s --check-prefixes=NOUNDEF,NOUNDEF_ONLY5// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -O2 -fsanitize=kernel-memory -mllvm -msan-eager-checks -o - %s | \6// RUN:     FileCheck %s --check-prefixes=NOUNDEF,EAGER7// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -O2 -fsanitize=kernel-memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \8// RUN:     FileCheck %s --check-prefixes=CLEAN9// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -O2 -fsanitize=kernel-memory -o - %s | \10// RUN:     FileCheck %s --check-prefixes=NOUNDEF,EAGER11 12void foo();13 14void bar(int x) {15  if (x)16    foo();17}18 19 20// CLEAN:   define dso_local void @bar(i32 %x)21// NOUNDEF: define dso_local void @bar(i32 noundef %x)22//23// %param_shadow assignment gets optimized away with -O2, because it is at the beginning of the24// struct returned by __msan_get_context_state(). Use %param_origin as a sign that the shadow of25// the first argument is being used.26//27// Without noundef analysis, KMSAN emits metadata checks for the function parameter.28// CLEAN:        load i32, ptr %param_origin29//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_origin33//34// With noundef analysis and eager checks enabled, KMSAN won't emit metadata checks for function35// parameters.36// EAGER-NOT:    load i32, ptr %param_origin37