Files
swift-mirror/test/Profiler/coverage_dead_code_elim_onone.swift
Hamish Knight 01c7c16c18 [IRGen] Allow lazy emission of coverage mapped functions
We previously eagerly emitted such functions to
ensure that their name data is emitted through the
profiler increment. Now that are able to emit the
profile name data separately, this is unnecessary,
and we can avoid emitting their definitions.
2022-09-16 15:47:17 +01:00

15 lines
771 B
Swift

// RUN: %target-swift-frontend -emit-sil -profile-generate -profile-coverage-mapping -module-name coverage_deadcode %s | %FileCheck %s -check-prefix SIL
// RUN: %target-swift-frontend -emit-ir -profile-generate -profile-coverage-mapping -module-name coverage_deadcode %s | %FileCheck %s -check-prefix IR
// This function needs to be present in the SIL for the mandatory passes, but
// we can drop it in IRGen. We still need to emit its coverage map though.
func unused() -> Int { 5 }
// SIL: sil hidden @$s17coverage_deadcode6unusedSiyF : $@convention(thin) () -> Int
// SIL: sil_coverage_map {{.*}} "$s17coverage_deadcode6unusedSiyF"
// IR: @__covrec
// IR: @__llvm_coverage_mapping
// IR: @__llvm_prf_nm
// IR-NOT: define {{.*}} @"$s17coverage_deadcode6unusedSiyF"