1; Test -sanitizer-coverage-trace-compares=1 2; RUN: opt < %s -sancov -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -S -enable-new-pm=0 | FileCheck %s 3; RUN: opt < %s -passes='module(sancov-module)' -sanitizer-coverage-level=1 -sanitizer-coverage-trace-compares=1 -S | FileCheck %s 4 5target 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" 6target triple = "x86_64-unknown-linux-gnu" 7define i32 @foo(i32 %a, i32 %b) #0 { 8entry: 9 10; compare (non-const, non-const) 11 %cmp = icmp slt i32 %a, %b 12; CHECK: call void @__sanitizer_cov_trace_cmp4 13; CHECK-NEXT: icmp slt i32 %a, %b 14 15; compare (const, non-const) 16 icmp slt i32 %a, 1 17; CHECK: call void @__sanitizer_cov_trace_const_cmp4(i32 1, i32 %a) 18; CHECK-NEXT: icmp slt i32 %a, 1 19 20; compare (non-const, const) 21 icmp slt i32 1, %a 22; CHECK: call void @__sanitizer_cov_trace_const_cmp4(i32 1, i32 %a) 23; CHECK-NEXT: icmp slt i32 1, %a 24 25; compare (const, const) - should not be instrumented 26 icmp slt i32 1, 0 27; CHECK-NOT: call void @__sanitizer_cov_trace 28; CHECK: icmp slt i32 1, 0 29 30; compare variables of byte size 31 %x = trunc i32 %a to i8 32 33 icmp slt i8 %x, 1 34; CHECK: call void @__sanitizer_cov_trace_const_cmp1(i8 1, i8 %x) 35; CHECK-NEXT: icmp slt i8 %x, 1 36 37 icmp slt i8 1, %x 38; CHECK: call void @__sanitizer_cov_trace_const_cmp1(i8 1, i8 %x) 39; CHECK-NEXT: icmp slt i8 1, %x 40 41; compare variables of word size 42 %y = trunc i32 %a to i16 43 44 icmp slt i16 %y, 1 45; CHECK: call void @__sanitizer_cov_trace_const_cmp2(i16 1, i16 %y) 46; CHECK-NEXT: icmp slt i16 %y, 1 47 48 icmp slt i16 1, %y 49; CHECK: call void @__sanitizer_cov_trace_const_cmp2(i16 1, i16 %y) 50; CHECK-NEXT: icmp slt i16 1, %y 51 52; compare variables of qword size 53 %z = zext i32 %a to i64 54 55 icmp slt i64 %z, 1 56; CHECK: call void @__sanitizer_cov_trace_const_cmp8(i64 1, i64 %z) 57; CHECK-NEXT: icmp slt i64 %z, 1 58 59 icmp slt i64 1, %z 60; CHECK: call void @__sanitizer_cov_trace_const_cmp8(i64 1, i64 %z) 61; CHECK-NEXT: icmp slt i64 1, %z 62 63 %conv = zext i1 %cmp to i32 64 ret i32 %conv 65} 66