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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343686
91177308-0d34-0410-b5e6-
96231b3b80d8
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())