This Idom check seems unnecessary. The immediate children of a node on the Dominator Tree should always be the IDom of its immediate children in this case.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Sink.cpp | ||
---|---|---|
172 ↗ | (On Diff #78822) | Add a comment here to explain why you don't need to check. |
lib/Transforms/Scalar/Sink.cpp | ||
---|---|---|
174 ↗ | (On Diff #92295) | I wouldn't even bother with this assert. Honestly, this whole code is silly. If you want to take a whack at it, the proper (IMHO) way to do this is: ncdblock = find nearestcommondominator(blocks that contain uses) If ncdblock == Inst->getParent(), stop, can't sink. This will sink as low as possible. |
lib/Transforms/Scalar/Sink.cpp | ||
---|---|---|
174 ↗ | (On Diff #92295) | Thats what I have in mind as well. However, this would work well for sinking SSA values, but not memory reading/writing instructions. Sink.cpp has some simple abilities to sink loads and stores. |
lib/Transforms/Scalar/Sink.cpp | ||
---|---|---|
174 ↗ | (On Diff #92295) | By SSA values I meant instructions without reading/writing to memory. |
lib/Transforms/Scalar/Sink.cpp | ||
---|---|---|
174 ↗ | (On Diff #92295) | If we cared, we'd just run MemorySSA, and for loads/stores, and then you have the SSA form you need to sink stores |
Ok, I have not had the time to look at the MemorySSA work (I have plan to get to it in the near future). I will land this for now. This pass probably needs to be significantly changed (essentially rewritten) later if we need it.