[PATCH] D30145: AMDGPU/SI: Fix SI scheduler LiveOut Refcount issue
Axel Davy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 22 12:04:12 PDT 2017
axeldavy updated this revision to Diff 92675.
axeldavy added a comment.
Prevented a set copy using a reference.
Repository:
rL LLVM
https://reviews.llvm.org/D30145
Files:
lib/Target/AMDGPU/SIMachineScheduler.cpp
lib/Target/AMDGPU/SIMachineScheduler.h
Index: lib/Target/AMDGPU/SIMachineScheduler.h
===================================================================
--- lib/Target/AMDGPU/SIMachineScheduler.h
+++ lib/Target/AMDGPU/SIMachineScheduler.h
@@ -467,6 +467,14 @@
return InRegs;
}
+ std::set<unsigned> getOutRegs() {
+ std::set<unsigned> OutRegs;
+ for (const auto &RegMaskPair : RPTracker.getPressure().LiveOutRegs) {
+ OutRegs.insert(RegMaskPair.RegUnit);
+ }
+ return OutRegs;
+ };
+
unsigned getVGPRSetID() const { return VGPRSetID; }
unsigned getSGPRSetID() const { return SGPRSetID; }
Index: lib/Target/AMDGPU/SIMachineScheduler.cpp
===================================================================
--- lib/Target/AMDGPU/SIMachineScheduler.cpp
+++ lib/Target/AMDGPU/SIMachineScheduler.cpp
@@ -1350,6 +1350,24 @@
std::set<unsigned> InRegs = DAG->getInRegs();
addLiveRegs(InRegs);
+ // Increase LiveOutRegsNumUsages for blocks
+ // producing registers consumed in another
+ // scheduling region.
+ for (unsigned Reg : DAG->getOutRegs()) {
+ for (unsigned i = 0, e = Blocks.size(); i != e; ++i) {
+ // Do reverse traversal
+ int ID = BlocksStruct.TopDownIndex2Block[Blocks.size()-1-i];
+ SIScheduleBlock *Block = Blocks[ID];
+ const std::set<unsigned> &OutRegs = Block->getOutRegs();
+
+ if (OutRegs.find(Reg) == OutRegs.end())
+ continue;
+
+ ++LiveOutRegsNumUsages[ID][Reg];
+ break;
+ }
+ }
+
// Fill LiveRegsConsumers for regs that were already
// defined before scheduling.
for (unsigned i = 0, e = Blocks.size(); i != e; ++i) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30145.92675.patch
Type: text/x-patch
Size: 1603 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170322/06f8b4e5/attachment.bin>
More information about the llvm-commits
mailing list