[llvm] [X86] Skip unused VRegs traverse (PR #78229)

Evgenii Kudriashov via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 07:30:54 PST 2024


================
@@ -667,7 +667,8 @@ bool X86FastPreTileConfig::runOnMachineFunction(MachineFunction &MFunc) {
   bool HasVirtTileReg = false;
   for (unsigned I = 0, E = NumVirtRegs; I != E; ++I) {
     Register VirtReg = Register::index2VirtReg(I);
-    if (MRI->getRegClass(VirtReg)->getID() == X86::TILERegClassID) {
+    if (!MRI->reg_nodbg_empty(VirtReg) &&
+        MRI->getRegClass(VirtReg)->getID() == X86::TILERegClassID) {
----------------
e-kud wrote:

I'm not sure. It's not a problem to replace `==` with `TRI->isTileRegisterClass(MRI->getRegClass(VirtReg))` however we need to change `const TargetRegisterInfo *TRI -> const X86RegisterInfo *TRI` as well. The problem is that we have several static functions in this file where `TRI` is unavailable and we need to pass it through several calls. So, fixing this one place and leaving all others with explicit comparison don't make the situation much better. Initially they are at least consistent within the file. If we are interested in such refactor, I can do it separately. 

https://github.com/llvm/llvm-project/pull/78229


More information about the llvm-commits mailing list