A simple coverage optimization: if the node has no successors, but multiple predecessors, do not instrument, as predecessors would be instrumented.
Landing this commit would allow us to revert the changes done to tests in https://github.com/llvm-mirror/llvm/commit/1f57bbafaf2dd66752e859d523f941c0b035ec8d
Details
- Reviewers
kcc
Diff Detail
Event Timeline
Hm... I keep not liking this...
A very simple test case will get too many extra edges instrumented if we get rid of PDOMs, even with your extra optimization.
I have such test, but would you like to come up with a test of your own?
If you give up, I'll send mine.
too many extra edges instrumented
weren't the benchmarks showing ~15%?
I have such test
yes please, do send it.
but would you like to come up with a test of your own?
I have a very artificial one, see attached. I am not sure that it counts, and the fact that "too many" is not formally defined makes it more difficult.
void foo(int *a, int *b) {
if (*a > 0) { b[1] = 0; if (*a > 10) { b[3] = 0; } else { b[4] = 0; } } else { if (*a < -10) { b[5] = 0; } else { b[6] = 0; } b[2] = 0; }
}
@kcc, right, missed that entirely.
What about "is a full post-dominator AND has more than one predecessors" ?
Solves these issues, and ensures that predecessor nodes are not full dominators, yet becomes close to the initial solution in D31266.
Alternatively, I can just take D31266 and add shorter tests.
What about "is a full post-dominator AND has more than one predecessors" ?
Yes, I was thinking about this, or, maybe actually
"is a full post-dominator AND has more than one *different* predecessor"
(I don't know if it's possible to have one block to be listed twice in the pred list)
(I don't know if it's possible to have one block to be listed twice in the pred list)
Almost certainly not, from a brief glance quite a lot of code in LLVM codebase relies on getSinglePredecessor check, including dominator tree calculation.
so can I make this change + use your test case to verify that we don't end up with extra instrumentation?