summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/CalcSpillWeights.cpp
diff options
context:
space:
mode:
authorJonas Paulsson <paulsson@linux.vnet.ibm.com>2018-10-03 12:51:19 +0000
committerJonas Paulsson <paulsson@linux.vnet.ibm.com>2018-10-03 12:51:19 +0000
commitfb3a97bec033e1b8243404678e0149c4c268ef41 (patch)
tree4bef72d9e07e103c4d50e589ab0da0b99a72fde2 /llvm/lib/CodeGen/CalcSpillWeights.cpp
parent5a768ddd449f51092f68625579b8b478a61be4c5 (diff)
downloadbcm5719-llvm-fb3a97bec033e1b8243404678e0149c4c268ef41.tar.gz
bcm5719-llvm-fb3a97bec033e1b8243404678e0149c4c268ef41.zip
[RA CopyHints] Fix compile-time regression
This patch makes sure that a register is only hinted once to RA. In extreme cases the same register can otherwise be hinted numerous times and cause a compile time slowdown. Review: Simon Pilgrim https://reviews.llvm.org/D52826 llvm-svn: 343686
Diffstat (limited to 'llvm/lib/CodeGen/CalcSpillWeights.cpp')
-rw-r--r--llvm/lib/CodeGen/CalcSpillWeights.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/CalcSpillWeights.cpp b/llvm/lib/CodeGen/CalcSpillWeights.cpp
index 57541182cab..7f89601da23 100644
--- a/llvm/lib/CodeGen/CalcSpillWeights.cpp
+++ b/llvm/lib/CodeGen/CalcSpillWeights.cpp
@@ -287,9 +287,11 @@ float VirtRegAuxInfo::weightCalcHelper(LiveInterval &li, SlotIndex *start,
if (TargetHint.first == 0 && TargetHint.second)
mri.clearSimpleHint(li.reg);
+ std::set<unsigned> HintedRegs;
for (auto &Hint : CopyHints) {
- if (TargetHint.first != 0 && Hint.Reg == TargetHint.second)
- // Don't add again the target-type hint.
+ if (!HintedRegs.insert(Hint.Reg).second ||
+ (TargetHint.first != 0 && Hint.Reg == TargetHint.second))
+ // Don't add the same reg twice or the target-type hint again.
continue;
mri.addRegAllocationHint(li.reg, Hint.Reg);
if (!tri.enableMultipleCopyHints())
OpenPOWER on IntegriCloud