The LiveOuts of a scheduling region were not properly refcounted,
thus the scheduler was incorrectly expecting them to be released
when the last block of the region using them as scheduled.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Target/AMDGPU/SIMachineScheduler.cpp | ||
---|---|---|
1372 ↗ | (On Diff #89038) | const reference |
1374–1381 ↗ | (On Diff #89038) | Double map lookup, use the iterator returned by find |
I added the suggested changes.
Also, it seems that incrementing non-existing map element will create it with value 0 (and then increment it), thus I don't need to check at all the existence:
++LiveOutRegsNumUsages[ID][Reg];
is enough.
I will propose a patch that will update the other cases in the code that would benefit this.
lib/Target/AMDGPU/SIMachineScheduler.cpp | ||
---|---|---|
1372 ↗ | (On Diff #89800) | constructing std::set every time you need to find one register in it is an obvious overkill. In this case its better to swap these two loops, construct the OutRegs set once for a block and then search all out regs there. |
lib/Target/AMDGPU/SIMachineScheduler.cpp | ||
---|---|---|
1372 ↗ | (On Diff #89800) | Sorry, I didn't know for (-U9999999) when I sent this patch, I'll update with it. Probably the good way is const std::set<unsigned> &OutRegs = Block->getOutRegs(); For blocks, the result of getOutRegs is computed once. This is different to DAG->getOutRegs, which is added in this patch. |