llvm.org GIT mirror llvm / ec8a2f2
[sanitizer-coverage] make sure that calls to __sanitizer_cov_trace_pc are not merged (otherwise different calls get the same PC and confuse fuzzers) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275449 91177308-0d34-0410-b5e6-96231b3b80d8 Kostya Serebryany 4 years ago
2 changed file(s) with 12 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
543543 Type *Int32PtrTy = PointerType::getUnqual(IRB.getInt32Ty());
544544 GuardP = IRB.CreateIntToPtr(GuardP, Int32PtrTy);
545545 if (Options.TracePC) {
546 IRB.CreateCall(SanCovTracePC);
546 IRB.CreateCall(SanCovTracePC); // gets the PC using GET_CALLER_PC.
547 IRB.CreateCall(EmptyAsm, {}); // Avoids callback merge.
547548 } else if (Options.TraceBB) {
548549 IRB.CreateCall(IsEntryBB ? SanCovTraceEnter : SanCovTraceBB, GuardP);
549550 } else if (UseCalls) {
55 ; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -sanitizer-coverage-block-threshold=1 -S | FileCheck %s --check-prefix=CHECK_WITH_CHECK
66 ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-block-threshold=10 -S | FileCheck %s --check-prefix=CHECK3
77 ; RUN: opt < %s -sancov -sanitizer-coverage-level=4 -S | FileCheck %s --check-prefix=CHECK4
8 ; RUN: opt < %s -sancov -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc -S | FileCheck %s --check-prefix=CHECK_TRACE_PC_INDIR
8 ; RUN: opt < %s -sancov -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc -S | FileCheck %s --check-prefix=CHECK_TRACE_PC
99 ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-8bit-counters=1 -S | FileCheck %s --check-prefix=CHECK-8BIT
1010
1111 ; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -sanitizer-coverage-block-threshold=10 \
119119 ; CHECK4-NOT: call void @__sanitizer_cov_indir_call16({{.*}},[[CACHE]])
120120 ; CHECK4: ret void
121121
122 ; CHECK_TRACE_PC_INDIR-LABEL: define void @CallViaVptr
123 ; CHECK_TRACE_PC_INDIR: call void @__sanitizer_cov_trace_pc_indir
124 ; CHECK_TRACE_PC_INDIR: call void @__sanitizer_cov_trace_pc_indir
125 ; CHECK_TRACE_PC_INDIR: ret void
122 ; CHECK_TRACE_PC-LABEL: define void @foo
123 ; CHECK_TRACE_PC: call void @__sanitizer_cov_trace_pc
124 ; CHECK_TRACE_PC: call void asm sideeffect "", ""()
125 ; CHECK_TRACE_PC: ret void
126
127 ; CHECK_TRACE_PC-LABEL: define void @CallViaVptr
128 ; CHECK_TRACE_PC: call void @__sanitizer_cov_trace_pc_indir
129 ; CHECK_TRACE_PC: call void @__sanitizer_cov_trace_pc_indir
130 ; CHECK_TRACE_PC: ret void
126131
127132 define void @call_unreachable() uwtable sanitize_address {
128133 entry: