The new algorithm is more efficient (O(n), n is number of basic blocks). And it is guaranteed to cover all cases of multiple BB mapped to same line.
Details
Diff Detail
Event Timeline
Thanks for this. The new algorithm seems much more straightforward than what I wrote initially.
lib/Transforms/Utils/AddDiscriminators.cpp | ||
---|---|---|
179 | Please describe at a high level how the algorithm finds location that need a discriminator. | |
188 | Prefer if this is expressed as L = std::make_pair(DIL->getFilename(), DIL->getLine()); | |
189 | s/NULL/nullptr/ | |
190 | Could you cache the access to LBM[L] into a reference to avoid the double lookup? | |
192 | Here, it would be useful to add a comment along the lines of: "If we could insert a different block in the same location, a discriminator is needed to distinguish both instructions." | |
196 | Could you create a reference to R.first->second and R.second? It's easier to have a symbolic name associated to track what the code is doing. |
Please describe at a high level how the algorithm finds location that need a discriminator.