-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report coverage 0
of dead blocks
#84797
Conversation
Fixes: rust-lang#84018 With `-Z instrument-coverage`, coverage reporting of dead blocks (for example, blocks dropped because a conditional branch is dropped, based on const evaluation) is now supported. If `instrument-coverage` is enabled, `simplify::remove_dead_blocks()` finds all dropped coverage `Statement`s and adds their `code_region`s as `Unreachable` coverage `Statement`s to the `START_BLOCK`, so they are still included in the coverage map. Check out the resulting changes in the test coverage reports in this PR.
@bors r+ |
📌 Commit 3fca198 has been approved by |
…nts, r=tmandry Report coverage `0` of dead blocks Fixes: rust-lang#84018 With `-Z instrument-coverage`, coverage reporting of dead blocks (for example, blocks dropped because a conditional branch is dropped, based on const evaluation) is now supported. If `instrument-coverage` is enabled, `simplify::remove_dead_blocks()` finds all dropped coverage `Statement`s and adds their `code_region`s as `Unreachable` coverage `Statement`s to the `START_BLOCK`, so they are still included in the coverage map. Check out the resulting changes in the test coverage reports in this PR. I also addressed an outstanding issue/request to move coverage tests from run-make-fulldeps to run-make (in commit 2). Fixes: rust-lang#83830 r? `@tmandry` cc: `@wesleywiser`
…nts, r=tmandry Report coverage `0` of dead blocks Fixes: rust-lang#84018 With `-Z instrument-coverage`, coverage reporting of dead blocks (for example, blocks dropped because a conditional branch is dropped, based on const evaluation) is now supported. If `instrument-coverage` is enabled, `simplify::remove_dead_blocks()` finds all dropped coverage `Statement`s and adds their `code_region`s as `Unreachable` coverage `Statement`s to the `START_BLOCK`, so they are still included in the coverage map. Check out the resulting changes in the test coverage reports in this PR. I also addressed an outstanding issue/request to move coverage tests from run-make-fulldeps to run-make (in commit 2). Fixes: rust-lang#83830 r? ``@tmandry`` cc: ``@wesleywiser``
…nts, r=tmandry Report coverage `0` of dead blocks Fixes: rust-lang#84018 With `-Z instrument-coverage`, coverage reporting of dead blocks (for example, blocks dropped because a conditional branch is dropped, based on const evaluation) is now supported. If `instrument-coverage` is enabled, `simplify::remove_dead_blocks()` finds all dropped coverage `Statement`s and adds their `code_region`s as `Unreachable` coverage `Statement`s to the `START_BLOCK`, so they are still included in the coverage map. Check out the resulting changes in the test coverage reports in this PR. I also addressed an outstanding issue/request to move coverage tests from run-make-fulldeps to run-make (in commit 2). Fixes: rust-lang#83830 r? ```@tmandry``` cc: ```@wesleywiser```
…nts, r=tmandry Report coverage `0` of dead blocks Fixes: rust-lang#84018 With `-Z instrument-coverage`, coverage reporting of dead blocks (for example, blocks dropped because a conditional branch is dropped, based on const evaluation) is now supported. If `instrument-coverage` is enabled, `simplify::remove_dead_blocks()` finds all dropped coverage `Statement`s and adds their `code_region`s as `Unreachable` coverage `Statement`s to the `START_BLOCK`, so they are still included in the coverage map. Check out the resulting changes in the test coverage reports in this PR. I also addressed an outstanding issue/request to move coverage tests from run-make-fulldeps to run-make (in commit 2). Fixes: rust-lang#83830 r? ````@tmandry```` cc: ````@wesleywiser````
…nts, r=tmandry Report coverage `0` of dead blocks Fixes: rust-lang#84018 With `-Z instrument-coverage`, coverage reporting of dead blocks (for example, blocks dropped because a conditional branch is dropped, based on const evaluation) is now supported. If `instrument-coverage` is enabled, `simplify::remove_dead_blocks()` finds all dropped coverage `Statement`s and adds their `code_region`s as `Unreachable` coverage `Statement`s to the `START_BLOCK`, so they are still included in the coverage map. Check out the resulting changes in the test coverage reports in this PR. I also addressed an outstanding issue/request to move coverage tests from run-make-fulldeps to run-make (in commit 2). Fixes: rust-lang#83830 r? `````@tmandry````` cc: `````@wesleywiser`````
…nts, r=tmandry Report coverage `0` of dead blocks Fixes: rust-lang#84018 With `-Z instrument-coverage`, coverage reporting of dead blocks (for example, blocks dropped because a conditional branch is dropped, based on const evaluation) is now supported. If `instrument-coverage` is enabled, `simplify::remove_dead_blocks()` finds all dropped coverage `Statement`s and adds their `code_region`s as `Unreachable` coverage `Statement`s to the `START_BLOCK`, so they are still included in the coverage map. Check out the resulting changes in the test coverage reports in this PR. I also addressed an outstanding issue/request to move coverage tests from run-make-fulldeps to run-make (in commit 2). Fixes: rust-lang#83830 r? ``````@tmandry`````` cc: ``````@wesleywiser``````
…nts, r=tmandry Report coverage `0` of dead blocks Fixes: rust-lang#84018 With `-Z instrument-coverage`, coverage reporting of dead blocks (for example, blocks dropped because a conditional branch is dropped, based on const evaluation) is now supported. If `instrument-coverage` is enabled, `simplify::remove_dead_blocks()` finds all dropped coverage `Statement`s and adds their `code_region`s as `Unreachable` coverage `Statement`s to the `START_BLOCK`, so they are still included in the coverage map. Check out the resulting changes in the test coverage reports in this PR. I also addressed an outstanding issue/request to move coverage tests from run-make-fulldeps to run-make (in commit 2). Fixes: rust-lang#83830 r? ```````@tmandry``````` cc: ```````@wesleywiser```````
This looks like it could be an important difference between Lines 1380 to 1387 in 3fca198
@cuviper - It looks like you may have added this in the last year or so. Is there any reason not to also add LLVM's library path to Do you think this would explain the error on MUSL target(s)? failed to execute command: "musl-g++" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-march=i686" "-Wl,-melf_i386" "-static" "-Wa,-mrelax-relocations=no" "-print-file-name=libstdc++.a" |
By the way, I also just realized this would be the first So moving these tests to |
3fca198
to
0b0d293
Compare
I removed the commit that moved the tests to Can someone please re-approve/send to bors? Thanks! |
@richkadel You might want to remove "fixes #83830" from the PR description. |
Good catch! Done. |
@bors r=tmandry rollup=iffy |
📌 Commit 0b0d293 has been approved by |
☀️ Test successful - checks-actions |
Fixes: rust-lang#83830 The first commit was migrated from another PR that failed because CI had errors likely resulting from trying to run the coverage tests in run-make. (See: rust-lang#84797 (comment)) So moving the tests should be done as it's own separate PR. To attempt to resolve those CI errors, this PR also updates bootstrap to add LLVM library link path to run-make. When moving coverage tests from run-make-fulldeps to run-make, some targets failed in CI with an obscure message: failed to execute command: "musl-g++" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-march=i686" "-Wl,-melf_i386" "-static" "-Wa,-mrelax-relocations=no" "-print-file-name=libstdc++.a" error: No such file or directory (os error 2) The coverage tests include # needs-profiler-support and these are the first run-make tests to require it (as far as I can tell). There is a special case in bootstrap for adding the LLVM library link path, and it applies to run-make-fulldeps. This commit adds it for run-make as well.
Fixes: rust-lang#85081 An `assert!()` in `FunctionCoverage` failed, because PR rust-lang#84797 replaces unreachable `Counter`s with `Unreachable` code regions to be added to the function's coverage map. To fix it, and still generate valid LLVM coverage IR, convert one unreachable to a `Counter`.
It looks like this commit is causing two issues, an ICE (as explained in #85081 ) and (with the ICE fixed in proposed PR #85082) malformed coverage data that results in an With the proposed ICE fix, now I see the I have a strong theory (based on a conversation with I'm going to revert this commit since I'm still waiting for answers, and in the mean time, |
…-statements, r=tmandry Revert "Auto merge of rust-lang#84797 - richkadel:cover-unreachable-statements… This reverts commit e5f83d2, reversing changes made to ac888e8. See rust-lang#84797 (comment) r? `@tmandry`
Rollup of 8 pull requests Successful merges: - rust-lang#83501 (rustdoc: Add unstable CLI option to show basic type layout information) - rust-lang#85018 (shrinking the deprecated method span) - rust-lang#85124 (rustdoc: remove explicit boolean comparisons.) - rust-lang#85136 (Change param name (k to key and v to value) in std::env module) - rust-lang#85162 (Fix typo in variable name) - rust-lang#85187 (Use .name_str() to format primitive types in error messages) - rust-lang#85191 (Improve rustdoc gui tester) - rust-lang#85196 (Revert "Auto merge of rust-lang#84797 - richkadel:cover-unreachable-statements…) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
...by saving dead counters/expressions. Unfortunately, I'm still getting the same result, when trying to get coverage from Fuchsia apps (at least those using fuchsia_async, but that may not be the specific cause): When running `llvm-cov` to get the coverage report, I get the well known and still useless message: ``` Failed to load coverage: Malformed instrumentation profile data ``` I can change CoverageMappingReader.cpp to avoid failing and I will see some coverage results (maybe most of the coverage results) but there is missing coverage as well. I don't know why the function name is not found. The "hack" is, change this: ```c++ if (Error Err = CFR->template getFuncName<Endian>(ProfileNames, FuncName)) return Err; if (FuncName.empty()) return make_error<InstrProfError>(instrprof_error::malformed); ++CovMapNumUsedRecords; ``` to this: ```c++ if (Error Err = CFR->template getFuncName<Endian>(ProfileNames, FuncName)) return Err; if (FuncName.empty()) FuncName = "MissingFuncNameForCoverage"; ++CovMapNumUsedRecords; ``` I did learn that the original implementation (replacing counters and expressions with Zero/unreachable counters), so this PR addresses that issue. I hoped that it would fix the problem, but it didn't. Specifically regarding the LLVM coverage adjustment (improvement?) made in this version, compared to the reverted PR (rust-lang#84797): LLVM requires all counters with code regions be added to the coverage map. The original dead block fix replaced the counters and expressions with a Zero (unreachable) code region. This commit saves the original counter or expression, without adding a statement to increment the counter for the eliminated dead block.
Fixes: #84018
With
-Z instrument-coverage
, coverage reporting of dead blocks(for example, blocks dropped because a conditional branch is dropped,
based on const evaluation) is now supported.
If
instrument-coverage
is enabled,simplify::remove_dead_blocks()
finds all dropped coverage
Statement
s and adds theircode_region
s asUnreachable
coverageStatement
s to theSTART_BLOCK
, so they arestill included in the coverage map.
Check out the resulting changes in the test coverage reports in this PR (in commit 1).
r? @tmandry
cc: @wesleywiser