Instead of creating a temporary call instruction and lowering that, use
SelectionDAGBuilder::lowerCallOperands.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Meta comment: I can't tell if this code is wrong, but it's not obviously correct. Your mixing renames, code motion, and restructuring unnecessarily. This makes it much harder to review for correctness.
lib/CodeGen/SelectionDAG/StatepointLowering.cpp | ||
---|---|---|
225 ↗ | (On Diff #24895) | To simplify review, please place the new code into the same helper. (I think the helper should be there regardless, but it also reduces the diff.) |
526 ↗ | (On Diff #24895) | This block looks like code which could and should be commoned into a helper function for statepoints and patchpoints. possible: findCallNode? |
537 ↗ | (On Diff #24895) | I would prefer the glue node changes go in separately. You do not need further review for them, but they're unrelated to the tricky part of this review and should be separated. |
571 ↗ | (On Diff #24895) | Use getGluedNode please. |
580 ↗ | (On Diff #24895) | You're missing a check on whether the underlying call produces a value. |
591 ↗ | (On Diff #24895) | I'm pretty sure using the entry point of the chain here is wrong. I don't understand the motivation for this change. Can you please separate or revert this part? |
lib/CodeGen/SelectionDAG/StatepointLowering.cpp | ||
---|---|---|
225 ↗ | (On Diff #24895) | will do. |
526 ↗ | (On Diff #24895) | I'll do that once this is in, if you're okay with that. |
537 ↗ | (On Diff #24895) | Will do. |
571 ↗ | (On Diff #24895) | Sure. |
580 ↗ | (On Diff #24895) | Yes. I wonder why this didn't break any tests. |
591 ↗ | (On Diff #24895) | The node copying the return value to a virtual register has a data dependence on the call, and it can thus be scheduled anywhere after the call and before the terminator instruction, but otherwise has no control dependencies. Adding it to PendingExports takes care of the latter. SelectionDAGBuilder::CopyValueToVirtualRegister does the same thing. |
This reduces the non-semantic noise in the change by keeping most of
the tricky parts of the change inside lowerCallFromStatepoint.
LGTM w/the requirement that you write a test which would have failed with your previous version and include it with the submission.
lib/CodeGen/SelectionDAG/StatepointLowering.cpp | ||
---|---|---|
281 ↗ | (On Diff #24996) | I would prefer you kept this comment in the new code. I regularly use it to remind myself what's going on here. |
llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp | ||
---|---|---|
277 | Can SelectionDAGBuilder::removeValue be removed now that this code no longer uses it? AFAICT this is the only user of that method (indeed, a comment inside that method indicates as much). |
Can SelectionDAGBuilder::removeValue be removed now that this code no longer uses it? AFAICT this is the only user of that method (indeed, a comment inside that method indicates as much).