-
Notifications
You must be signed in to change notification settings - Fork 10.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
[MC/DC] Introduce class TestVector
with a pair of BitVector
#82174
Conversation
This replaces `SmallVector<CondState>` and emulates it. - True False DontCare (Impossible) - Values: True False False True - Visited: True True False False `findIndependencePairs()` can be optimized with logical ops. FIXME: Specialize `findIndependencePairs()` for the single word.
BitVector Visited; /// ~DontCare | ||
|
||
public: | ||
/// Assume filling DontCare. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to pass Cond when it is not being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because the only user (TV
in findExecutedTestVectors()
) specifies DontCare
explicitly. I wanted to leave it since I thought it was more descriptive.
I can prune the initial value in this.
} | ||
|
||
/// Emulate RHS SmallVector::operator[] | ||
MCDCRecord::CondState operator[](int I) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you expand on this comment?
E.g.
For the condition at index \p I:
\returns MCDC_True when the condition has been visited
\returns MCDC_False when a condition has not been visited
\returns MCDC_DontCare when the condition does not impact MC/DC coverage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they might be redundant to explain here since this handles the enum.
/// Equivalent to buildTestVector's Index. | ||
auto getIndex() const { return Values.getData()[0]; } | ||
|
||
/// Emulate LHS SmallVector::operator[]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment could be like
Set the condition at position \p I's CondState to \p Val.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the code looks fine. I left a couple nits on comments. But otherwise, LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to wait for both @MaskRay and @evodius96 , since they are authors of the current impl.
BitVector Visited; /// ~DontCare | ||
|
||
public: | ||
/// Assume filling DontCare. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because the only user (TV
in findExecutedTestVectors()
) specifies DontCare
explicitly. I wanted to leave it since I thought it was more descriptive.
I can prune the initial value in this.
} | ||
|
||
/// Emulate RHS SmallVector::operator[] | ||
MCDCRecord::CondState operator[](int I) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they might be redundant to explain here since this handles the enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cost in the loop could be reduced more to adopt also #82282.
if (!A.isDifferentOutcome(B)) | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be eliminated.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be == 1
aka has_single_bit
.
This replaces
SmallVector<CondState>
and emulates it.findIndependencePairs()
can be optimized with logical ops.FIXME: Specialize
findIndependencePairs()
for the single word.