[PATCH] D126622: [X86][NFC] Refine X86 Domain Reassignment for compiling time

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 30 19:11:42 PDT 2022


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5d5aba78dbbe: [X86][NFC] Refine X86 Domain Reassignment for compiling time (authored by xiangzhangllvm).
Herald added a subscriber: jsji.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126622/new/

https://reviews.llvm.org/D126622

Files:
  llvm/lib/Target/X86/X86DomainReassignment.cpp


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<unsigned> EnclosedEdges;
+  BitVector EnclosedEdges{8, false};
 
   /// All instructions that are included in some closure.
   DenseMap<MachineInstr *, unsigned> EnclosedInstrs;
@@ -429,10 +430,10 @@
 void X86DomainReassignment::visitRegister(Closure &C, Register Reg,
                                           RegDomain &Domain,
                                           SmallVectorImpl<unsigned> &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<Closure> Closures;
@@ -756,7 +758,7 @@
       continue;
 
     // Register already in closure.
-    if (EnclosedEdges.count(Reg))
+    if (EnclosedEdges.test(Idx))
       continue;
 
     // Calculate closure starting with Reg.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126622.433005.patch
Type: text/x-patch
Size: 1853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220531/eb905da9/attachment.bin>


More information about the llvm-commits mailing list