summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveRegMatrix.cpp
diff options
context:
space:
mode:
authorMarina Yatsina <marina.yatsina@intel.com>2018-01-31 13:31:08 +0000
committerMarina Yatsina <marina.yatsina@intel.com>2018-01-31 13:31:08 +0000
commitcd5bc4a2cd5260c80f20544c8cf5f78056608fc9 (patch)
treea02dbac750fda5d4e766a1c7b1e9c2a1516b932c /llvm/lib/CodeGen/LiveRegMatrix.cpp
parent2e442a78312036309f53cb915c2c6a8c295b6575 (diff)
downloadbcm5719-llvm-cd5bc4a2cd5260c80f20544c8cf5f78056608fc9.tar.gz
bcm5719-llvm-cd5bc4a2cd5260c80f20544c8cf5f78056608fc9.zip
Take into account the cost of local intervals when selecting split candidate.
When selecting a split candidate for region splitting, the register allocator tries to predict which candidate will have the cheapest spill cost. Global splitting may cause the creation of local intervals, and they might spill. This patch makes RA take into account the spill cost of local split intervals in use blocks (we already take into account the spill cost in through blocks). A flag ("-condsider-local-interval-cost") controls weather we do this advanced cost calculation (it's on by default for X86 target, off for the rest). Differential Revision: https://reviews.llvm.org/D41585 Change-Id: Icccb8ad2dbf13124f5d97a18c67d95aa6be0d14d llvm-svn: 323870
Diffstat (limited to 'llvm/lib/CodeGen/LiveRegMatrix.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveRegMatrix.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LiveRegMatrix.cpp b/llvm/lib/CodeGen/LiveRegMatrix.cpp
index bd435968296..d8faf75466c 100644
--- a/llvm/lib/CodeGen/LiveRegMatrix.cpp
+++ b/llvm/lib/CodeGen/LiveRegMatrix.cpp
@@ -205,3 +205,19 @@ LiveRegMatrix::checkInterference(LiveInterval &VirtReg, unsigned PhysReg) {
return IK_Free;
}
+
+bool LiveRegMatrix::checkInterference(SlotIndex Start, SlotIndex End,
+ unsigned PhysReg) {
+ // Construct artificial live range containing only one segment [Start, End).
+ VNInfo valno(0, Start);
+ LiveRange::Segment Seg(Start, End, &valno);
+ LiveRange LR;
+ LR.addSegment(Seg);
+
+ // Check for interference with that segment
+ for (MCRegUnitIterator Units(PhysReg, TRI); Units.isValid(); ++Units) {
+ if (query(LR, *Units).checkInterference())
+ return true;
+ }
+ return false;
+}
OpenPOWER on IntegriCloud