Skip to content

Commit 5f6fcad

Browse files
committedAug 19, 2020
Auto merge of #75563 - richkadel:llvm-coverage-map-gen-5.4, r=wesleywiser
Moved coverage counter injection from BasicBlock to Statement. As discussed on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Implement.20LLVM-compatible.20source-based.20cod.20compiler-team.23278
·
1.88.01.47.0
2 parents 32c654a + d129ac2 commit 5f6fcad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+400
-787
lines changed
 

‎library/core/src/intrinsics.rs

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,70 +1949,6 @@ extern "rust-intrinsic" {
19491949
#[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079")]
19501950
pub fn ptr_offset_from<T>(ptr: *const T, base: *const T) -> isize;
19511951

1952-
/// Internal placeholder for injecting code coverage counters when the "instrument-coverage"
1953-
/// option is enabled. The source code region information is extracted prior to code generation,
1954-
/// and added to the "coverage map", which is injected into the generated code as additional
1955-
/// data. This intrinsic then triggers the generation of LLVM intrinsic call
1956-
/// `instrprof.increment`, using the remaining args (`function_source_hash` and `index`).
1957-
#[cfg(not(bootstrap))]
1958-
#[lang = "count_code_region"]
1959-
pub fn count_code_region(
1960-
function_source_hash: u64,
1961-
index: u32,
1962-
file_name: &'static str,
1963-
start_line: u32,
1964-
start_col: u32,
1965-
end_line: u32,
1966-
end_col: u32,
1967-
);
1968-
1969-
/// Internal marker for code coverage expressions, injected into the MIR when the
1970-
/// "instrument-coverage" option is enabled. This intrinsic is not converted into a
1971-
/// backend intrinsic call, but its arguments are extracted during the production of a
1972-
/// "coverage map", which is injected into the generated code, as additional data.
1973-
/// This marker identifies a code region and two other counters or counter expressions
1974-
/// whose sum is the number of times the code region was executed.
1975-
#[cfg(not(bootstrap))]
1976-
#[lang = "coverage_counter_add"]
1977-
pub fn coverage_counter_add(
1978-
index: u32,
1979-
left_index: u32,
1980-
right_index: u32,
1981-
file_name: &'static str,
1982-
start_line: u32,
1983-
start_col: u32,
1984-
end_line: u32,
1985-
end_col: u32,
1986-
);
1987-
1988-
/// This marker identifies a code region and two other counters or counter expressions
1989-
/// whose difference is the number of times the code region was executed.
1990-
/// (See `coverage_counter_add` for more information.)
1991-
#[cfg(not(bootstrap))]
1992-
#[lang = "coverage_counter_subtract"]
1993-
pub fn coverage_counter_subtract(
1994-
index: u32,
1995-
left_index: u32,
1996-
right_index: u32,
1997-
file_name: &'static str,
1998-
start_line: u32,
1999-
start_col: u32,
2000-
end_line: u32,
2001-
end_col: u32,
2002-
);
2003-
2004-
/// This marker identifies a code region to be added to the "coverage map" to indicate source
2005-
/// code that can never be reached.
2006-
/// (See `coverage_counter_add` for more information.)
2007-
#[cfg(not(bootstrap))]
2008-
pub fn coverage_unreachable(
2009-
file_name: &'static str,
2010-
start_line: u32,
2011-
start_col: u32,
2012-
end_line: u32,
2013-
end_col: u32,
2014-
);
2015-
20161952
/// See documentation of `<*const T>::guaranteed_eq` for details.
20171953
#[rustc_const_unstable(feature = "const_raw_ptr_comparison", issue = "53020")]
20181954
pub fn ptr_guaranteed_eq<T>(ptr: *const T, other: *const T) -> bool;

‎src/librustc_codegen_llvm/builder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
11171117
hash: &'ll Value,
11181118
num_counters: &'ll Value,
11191119
index: &'ll Value,
1120-
) -> &'ll Value {
1120+
) {
11211121
debug!(
11221122
"instrprof_increment() with args ({:?}, {:?}, {:?}, {:?})",
11231123
fn_name, hash, num_counters, index
@@ -1128,13 +1128,13 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
11281128
let args = self.check_call("call", llfn, args);
11291129

11301130
unsafe {
1131-
llvm::LLVMRustBuildCall(
1131+
let _ = llvm::LLVMRustBuildCall(
11321132
self.llbuilder,
11331133
llfn,
11341134
args.as_ptr() as *const &llvm::Value,
11351135
args.len() as c_uint,
11361136
None,
1137-
)
1137+
);
11381138
}
11391139
}
11401140

0 commit comments

Comments
 (0)
Please sign in to comment.