This patch includes logic in the Scheduling phase of Instruction selection to check whether or not a CopyToReg will clobber a physical register's live range. If so, the scheduler will not be able to schedule the instruction in the current cycle with the current partial schedule. Without this, the scheduler can schedule CopyToRegs even if they violate a live range, resulting in correctness bugs.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Ported over to phab review to land in Trunk. Addressed the requests in initial review, renamed test file to better align with naming of previous test.
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp | ||
---|---|---|
451 | The check for LiveRegDefs[*AI] is excessive. If Node is not null the last check will not succeed. |
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp | ||
---|---|---|
1311 | Do you really want to insert it if Node is nullptr? |
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp | ||
---|---|---|
1311 | Hey Stas -- thanks for comments. The are two theoretical ways Node will be nullptr. 1. We are using default value, 2. The SDNode we passed is actually a nullptr. Neither way creates a problem for this condition.
|
LGTM with a small nit - run instnamer on the test. There should be no unnamed variables. Or rename it manually.
llvm/test/CodeGen/AMDGPU/copy-to-reg-scc-clobber.ll | ||
---|---|---|
3 | If you're going to test the different schedulers, should use the explicit flag for each one |
Run instnamer on testfile, explicitly use "source" (RRList) scheduler for InstSelection Scheduler in test.
The check for LiveRegDefs[*AI] is excessive. If Node is not null the last check will not succeed.