diff options
author | Mircea Trofin <mtrofin@google.com> | 2021-10-30 20:47:22 -0700 |
---|---|---|
committer | Mircea Trofin <mtrofin@google.com> | 2021-11-02 18:26:54 -0700 |
commit | 34f4fe3a9009d4443ff166a36d7ddb07e3ebb512 (patch) | |
tree | f42ac91452d5c8ec440a93117666a644b1ae81d7 /llvm/lib/CodeGen/RegAllocBasic.cpp | |
parent | 1b108ab975c6000068a2e191f71aeaca880b49db (diff) | |
download | llvm-34f4fe3a9009d4443ff166a36d7ddb07e3ebb512.zip llvm-34f4fe3a9009d4443ff166a36d7ddb07e3ebb512.tar.gz llvm-34f4fe3a9009d4443ff166a36d7ddb07e3ebb512.tar.bz2 |
[NFC][Regalloc] Ensure Query::interferingVRegs is accurate.
To correctly use Query, one had to first call collectInterferingVRegs to
pre-cache the query result, then call interferingVRegs. Failing the
former, interferingVRegs could be stale. This did cause a bug which was
addressed in D98232, but the underlying usability issue of the Query API
wasn't.
This patch addresses the latter by making collectInterferingVRegs an
implementation detail, and having interferingVRegs play both roles. One
side-effect of this is that interferingVRegs is not const anymore.
Differential Revision: https://reviews.llvm.org/D112882
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocBasic.cpp')
-rw-r--r-- | llvm/lib/CodeGen/RegAllocBasic.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/RegAllocBasic.cpp b/llvm/lib/CodeGen/RegAllocBasic.cpp index b65d580..a9816b1 100644 --- a/llvm/lib/CodeGen/RegAllocBasic.cpp +++ b/llvm/lib/CodeGen/RegAllocBasic.cpp @@ -217,9 +217,7 @@ bool RABasic::spillInterferences(LiveInterval &VirtReg, MCRegister PhysReg, // Collect interferences assigned to any alias of the physical register. for (MCRegUnitIterator Units(PhysReg, TRI); Units.isValid(); ++Units) { LiveIntervalUnion::Query &Q = Matrix->query(VirtReg, *Units); - Q.collectInterferingVRegs(); - for (unsigned i = Q.interferingVRegs().size(); i; --i) { - LiveInterval *Intf = Q.interferingVRegs()[i - 1]; + for (auto *Intf : reverse(Q.interferingVRegs())) { if (!Intf->isSpillable() || Intf->weight() > VirtReg.weight()) return false; Intfs.push_back(Intf); |