[llvm] [MC/DC] Introduce `class TestVector` with a pair of `BitVector` (PR #82174)
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 19 14:13:44 PST 2024
================
@@ -323,22 +318,15 @@ class MCDCRecordProcessor {
for (unsigned J = 0; J < I; ++J) {
const MCDCRecord::TestVector &B = ExecVectors[J];
// Enumerate two execution vectors whose outcomes are different.
- if (A[NumConditions] == B[NumConditions])
+ if (!A.isDifferentOutcome(B))
continue;
- unsigned Flip = NumConditions, Idx;
- for (Idx = 0; Idx < NumConditions; ++Idx) {
- MCDCRecord::CondState ACond = A[Idx], BCond = B[Idx];
- if (ACond == BCond || ACond == MCDCRecord::MCDC_DontCare ||
- BCond == MCDCRecord::MCDC_DontCare)
- continue;
- if (Flip != NumConditions)
- break;
- Flip = Idx;
- }
// If the two vectors differ in exactly one condition, ignoring DontCare
// conditions, we have found an independence pair.
- if (Idx == NumConditions && Flip != NumConditions)
- IndependencePairs.insert({Flip, std::make_pair(J + 1, I + 1)});
+ auto AB = A.getDifferences(B);
+ assert(AB[NumConditions] && "The last element should be different");
+ if (AB.count() == 2) // The single condition and the last element
----------------
chapuni wrote:
This could be `== 1` aka `has_single_bit`.
https://github.com/llvm/llvm-project/pull/82174
More information about the llvm-commits
mailing list