Currently, clang crashes when there are several CUs with the same module.
It has been probably broken in:
https://github.com/llvm-mirror/llvm/commit/4eeaa0da042055b1cd17b339e2dde518a3026033#diff-fb31f653eead12db385ff358e2a2e504R499
So the goal of the patch is to fix it.
Details
Diff Detail
- Repository
- rL LLVM
- Build Status
Buildable 24079 Build 24078: arc lint + arc unit
Event Timeline
It would help to have a regression test for this (somewhere in test/Transforms/GCOVProfiling). Something that exercises emitProfileArcs with 2 CU's would work.
Here's a starting point:
Note that this actually crashes somewhere in emitProfileNotes. ASan reports a heap buffer overflow.
Thanks for the test case. The code for multiple CUs looks pretty buggy.
I'll have look on it to try to fix it.
Thank you for working on this. I don't have any experience or familiarity with gcov to give this a proper review. @uweigand or @sylvestre.ledru may be able to give a better review.
Very nice simplification, I hope this won't introduce regressions.
I think we should test the patch on Mozilla CI before landing, so we can be reasonably confident that it doesn't break things.
lib/Transforms/Instrumentation/GCOVProfiling.cpp | ||
---|---|---|
135 | It's a little confusing to have two variable names which are so similar. Maybe call the first CUToGCOVFunctions and the second CUToFunctions? | |
479 | Nit: Maybe keep the same convention of using this-> for member variables? | |
755 | There are some formatting changes here and there, did you make them with clang format? | |
test/Transforms/GCOVProfiling/function-numbering.ll | ||
27 | Do we have another test for the case where CUToCounters is not empty? I assume we don't. |
It's a little confusing to have two variable names which are so similar. Maybe call the first CUToGCOVFunctions and the second CUToFunctions?