The pass I'm working on only cares about the BranchInst
handling, which I know works. I don't currently have a way
to test the switch handling, so alternatively I could
just assert there is no DomTree to update for now.
Details
- Reviewers
kuhar
Diff Detail
Event Timeline
lib/Transforms/Utils/Local.cpp | ||
---|---|---|
129 | Can Dest1 and Dest2 be the same BB? If so, a check for that would be needed before removing the edge. LLVM IR forms a multigraph, while the DomTree updater API treats it more like a normal graph, and we have to check for multiedges. | |
205 | Same as above: are we sure that this is the only edge from SI->getParent() to DefaultDest? | |
243 | Same as with the other deletions. |
LGTM.
I would only add a comment for where you insert and look at .second highlighting the multiedge problem.
It turns out this was just a waste of my time and this was already implemented differently in r322401. I don't see specific tests for ConstantFoldTerminator in that commit, so I've gone ahead and committed the test portion in r322683
Can Dest1 and Dest2 be the same BB? If so, a check for that would be needed before removing the edge. LLVM IR forms a multigraph, while the DomTree updater API treats it more like a normal graph, and we have to check for multiedges.