Closed Quuxplusone closed 5 years ago
Bugzilla Link | PR40528 |
Status | RESOLVED FIXED |
Importance | P enhancement |
Reported by | Max Kazantsev (max.kazantsev@azul.com) |
Reported on | 2019-01-30 06:09:03 -0800 |
Last modified on | 2019-02-22 21:16:43 -0800 |
Version | trunk |
Hardware | PC Windows NT |
CC | htmldeveloper@gmail.com, kubakuderski@gmail.com, llvm-bugs@lists.llvm.org, simachijun@gmail.com |
Fixed by commit(s) | rL354437 |
Attachments | |
Blocks | |
Blocked by | |
See also |
Will try to take a look later this week. Thanks for the unit test.
Let's keep it open then. If you think it's not a bug, feel free to close as invalid and update the doc. Otherwise, please close it when it is fixed.
I.e. the comment for deleteEdge says
"Notify all available trees on an edge deletion.
If both DT and PDT are nullptrs, this function discards the update. Under either Strategy, self-dominance update will be removed. The Eager Strategy applies the update immediately while the Lazy Strategy queues the update. It is recommended to only use this method when you have exactly one deletion (and no insertions). It is recommended to use applyUpdates() in all other cases. This function has to be called after making the update on the actual CFG. An internal functions checks if the edge doesn't exist in the CFG in DEBUG mode."
If it's not a bug, then the phrase "It is recommended to only use this method when you have exactly one deletion" should be replaced with something more obliging, like "It is only legal to use this method to..."
The Eager update strategy of DTU is only a bare wrapper of relevant functions
of the underlying DominatorTree class. And the insertEdge()/deleteEdge()
function of the DominatorTree class cannot handle multiple updates safely.
There are also relevant issues on DominatorTree involving this before:
https://reviews.llvm.org/rL338184
"It's generally not possible to safely call insert/deleteEdge multiple times"
https://reviews.llvm.org/D49925
"AFAIU, for multiple CFG changes, DT should be updated using batch updates, vs
consecutive addEdge and removeEdge calls."
I'll create a patch to clarify this issue in the document. Thanks for the
report!