[llvm] [CodeGen] Do not retype an already typed vreg in constrainRegAttrs (PR #217410)

Arseniy Obolenskiy via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 11:16:14 PDT 2026


================
@@ -111,7 +111,7 @@ MachineRegisterInfo::constrainRegAttrs(Register Reg,
     } else if (RegCB != ConstrainingRegCB)
       return false;
   }
-  if (ConstrainingRegTy.isValid())
+  if (ConstrainingRegTy.isValid() && !RegTy.isValid())
----------------
aobolensk wrote:

If we don't constrain then llc hangs: canReplaceReg still matches on the loose `s32 == i32`, so replaceRegWith falls back to buildCopy and the new COPY matches again and again forever

Making both checks stop this hang

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


More information about the llvm-commits mailing list