[llvm] [Coverage] Rework Decision/Expansion/Branch (PR #78969)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 23:59:54 PST 2024


MaskRay wrote:

I think this is correct, but the consumer side complexity makes me wonder whether the additional complexity makes our "boring algorithm" overall worse than GCC https://gcc.gnu.org/pipermail/gcc-patches/2024-January/644269.html

(From https://maskray.me/blog/2024-01-28-mc-dc-and-compiler-implementations)

Pros:

* Easier to understand
* Each condition instrumentation adds just one single bitwise OR instruction, instead of possibly three (one bitwise AND plus two bitwise OR).

Cons:

* More bits to encode N conditions (`2**N` vs. `2*N`)
* More metadata to encode the reduced ordered BDDs, required by the reader to compute independence pairs
* Determining independent pairs involves a brute-force algorithm in llvm-cov, which has a high time complexity but probably acceptable due to the limited condition count.


https://github.com/llvm/llvm-project/pull/78969


More information about the llvm-commits mailing list