1 ; Test -sanitizer-coverage-trace-compares=1
2 ; RUN: opt < %s -passes='module(sancov-module)' -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -S | FileCheck %s
4 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
5 target triple = "x86_64-unknown-linux-gnu"
6 define i32 @foo(i32 %a, i32 %b) #0 {
9 ; compare (non-const, non-const)
10 %cmp = icmp slt i32 %a, %b
11 ; CHECK: call void @__sanitizer_cov_trace_cmp4
12 ; CHECK-NEXT: icmp slt i32 %a, %b
14 ; compare (const, non-const)
16 ; CHECK: call void @__sanitizer_cov_trace_const_cmp4(i32 1, i32 %a)
17 ; CHECK-NEXT: icmp slt i32 %a, 1
19 ; compare (non-const, const)
21 ; CHECK: call void @__sanitizer_cov_trace_const_cmp4(i32 1, i32 %a)
22 ; CHECK-NEXT: icmp slt i32 1, %a
24 ; compare (const, const) - should not be instrumented
26 ; CHECK-NOT: call void @__sanitizer_cov_trace
27 ; CHECK: icmp slt i32 1, 0
29 ; compare variables of byte size
30 %x = trunc i32 %a to i8
33 ; CHECK: call void @__sanitizer_cov_trace_const_cmp1(i8 1, i8 %x)
34 ; CHECK-NEXT: icmp slt i8 %x, 1
37 ; CHECK: call void @__sanitizer_cov_trace_const_cmp1(i8 1, i8 %x)
38 ; CHECK-NEXT: icmp slt i8 1, %x
40 ; compare variables of word size
41 %y = trunc i32 %a to i16
44 ; CHECK: call void @__sanitizer_cov_trace_const_cmp2(i16 1, i16 %y)
45 ; CHECK-NEXT: icmp slt i16 %y, 1
48 ; CHECK: call void @__sanitizer_cov_trace_const_cmp2(i16 1, i16 %y)
49 ; CHECK-NEXT: icmp slt i16 1, %y
51 ; compare variables of qword size
52 %z = zext i32 %a to i64
55 ; CHECK: call void @__sanitizer_cov_trace_const_cmp8(i64 1, i64 %z)
56 ; CHECK-NEXT: icmp slt i64 %z, 1
59 ; CHECK: call void @__sanitizer_cov_trace_const_cmp8(i64 1, i64 %z)
60 ; CHECK-NEXT: icmp slt i64 1, %z
62 %conv = zext i1 %cmp to i32