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 | ||
---|---|---|
182–183 | Please describe at a high level how the algorithm finds location that need a discriminator. | |
191 | Prefer if this is expressed as L = std::make_pair(DIL->getFilename(), DIL->getLine()); | |
192 | s/NULL/nullptr/ | |
193 | Could you cache the access to LBM[L] into a reference to avoid the double lookup? | |
195 | 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." | |
199 | 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.