Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / sancov-new-pm.c
blob5ba82cc1cb22a61d7037b5b99149faab5949edb0
1 // Test that SanitizerCoverage works under the new pass manager.
2 // RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O0
3 // RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -O2 -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O2
5 extern void *memcpy(void *, const void *, unsigned long);
6 extern int printf(const char *restrict, ...);
8 int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size) {
9 unsigned char buf[4];
11 if (size < 8)
12 return 0;
14 if (data[0] == 'h' && data[1] == 'i' && data[2] == '!') {
15 memcpy(buf, data, size);
16 printf("test: %.2X\n", buf[0]);
19 return 0;
22 // CHECK-DAG: declare void @__sanitizer_cov_pcs_init(ptr, ptr)
23 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_pc_indir(i64)
24 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_cmp1(i8 zeroext, i8 zeroext)
25 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_cmp2(i16 zeroext, i16 zeroext)
26 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_cmp4(i32 zeroext, i32 zeroext)
27 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_cmp8(i64, i64)
28 // CHECK-O2-NOT: declare void @__sanitizer_cov_trace_const_cmp1(i8 zeroext, i8 zeroext)
29 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_const_cmp2(i16 zeroext, i16 zeroext)
30 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_const_cmp4(i32 zeroext, i32 zeroext)
31 // CHECK-O2-NOT: declare void @__sanitizer_cov_trace_const_cmp8(i64, i64)
32 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_div4(i32 zeroext)
33 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_div8(i64)
34 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_gep(i64)
35 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_switch(i64, ptr)
36 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_pc()
37 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_pc_guard(ptr)