aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-06-11 18:16:27 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-06-11 18:16:27 +0000
commit687a64222b4c87c825258d4dfeb1f0794e8cb300 (patch)
treef15e528223c9e06e4ed874e21ad41c2eb169030b /lib/CodeGen
parent24eadf6f46cd3637ffe867648ce8eca7314115c6 (diff)
downloadsrc-vendor/llvm-80.tar.gz
src-vendor/llvm-80.zip
Notes
Notes: svn path=/vendor/llvm/dist-release_80/; revision=348932 svn path=/vendor/llvm/llvm-release_801-r366581/; revision=350167; tag=vendor/llvm/llvm-release_801-r366581
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/TargetRegisterInfo.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CodeGen/TargetRegisterInfo.cpp b/lib/CodeGen/TargetRegisterInfo.cpp
index 661dc18f7a85..d3059280a60f 100644
--- a/lib/CodeGen/TargetRegisterInfo.cpp
+++ b/lib/CodeGen/TargetRegisterInfo.cpp
@@ -14,6 +14,7 @@
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
+#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
@@ -398,6 +399,7 @@ TargetRegisterInfo::getRegAllocationHints(unsigned VirtReg,
const std::pair<unsigned, SmallVector<unsigned, 4>> &Hints_MRI =
MRI.getRegAllocationHints(VirtReg);
+ SmallSet<unsigned, 32> HintedRegs;
// First hint may be a target hint.
bool Skip = (Hints_MRI.first != 0);
for (auto Reg : Hints_MRI.second) {
@@ -411,6 +413,10 @@ TargetRegisterInfo::getRegAllocationHints(unsigned VirtReg,
if (VRM && isVirtualRegister(Phys))
Phys = VRM->getPhys(Phys);
+ // Don't add the same reg twice (Hints_MRI may contain multiple virtual
+ // registers allocated to the same physreg).
+ if (!HintedRegs.insert(Phys).second)
+ continue;
// Check that Phys is a valid hint in VirtReg's register class.
if (!isPhysicalRegister(Phys))
continue;