Index: llvm/lib/Target/X86/X86DomainReassignment.cpp =================================================================== --- llvm/lib/Target/X86/X86DomainReassignment.cpp +++ llvm/lib/Target/X86/X86DomainReassignment.cpp @@ -15,6 +15,7 @@ #include "X86.h" #include "X86InstrInfo.h" #include "X86Subtarget.h" +#include "llvm/ADT/BitVector.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMapInfo.h" #include "llvm/ADT/STLExtras.h" @@ -374,7 +375,7 @@ const X86InstrInfo *TII = nullptr; /// All edges that are included in some closure - DenseSet EnclosedEdges; + BitVector EnclosedEdges{8, false}; /// All instructions that are included in some closure. DenseMap EnclosedInstrs; @@ -429,10 +430,10 @@ void X86DomainReassignment::visitRegister(Closure &C, Register Reg, RegDomain &Domain, SmallVectorImpl &Worklist) { - if (EnclosedEdges.count(Reg)) + if (!Reg.isVirtual()) return; - if (!Reg.isVirtual()) + if (EnclosedEdges.test(Register::virtReg2Index(Reg))) return; if (!MRI->hasOneDef(Reg)) @@ -550,7 +551,7 @@ // Register already in this closure. if (!C.insertEdge(CurReg)) continue; - EnclosedEdges.insert(Reg); + EnclosedEdges.set(Register::virtReg2Index(Reg)); MachineInstr *DefMI = MRI->getVRegDef(CurReg); encloseInstr(C, DefMI); @@ -742,6 +743,7 @@ bool Changed = false; EnclosedEdges.clear(); + EnclosedEdges.resize(MRI->getNumVirtRegs()); EnclosedInstrs.clear(); std::vector Closures; @@ -756,7 +758,7 @@ continue; // Register already in closure. - if (EnclosedEdges.count(Reg)) + if (EnclosedEdges.test(Idx)) continue; // Calculate closure starting with Reg.